Seam Persistence Beta 1 has been released. To get started put the following in your pom.xml:
<dependency> <groupId>org.jboss.seam.persistence</groupId> <artifactId>seam-persistence-impl</artifactId> <version>3.0.0.Beta1</version> </dependency> <dependency> <groupId>org.jboss.weld</groupId> <artifactId>weld-extensions</artifactId> <version>1.0.0.Beta1</version> </dependency>
The release adds support for Seam managed Hibernate sessions, and fixes a bug where the SMPC would not join a transaction correctly if used outside a transaction.
Seam managed hibernate sessions are configured via producer methods:
@RequestScoped @Produces @SeamManaged public SessionFactory createSessionFactory() { Configuration config = new Configuration(); config.configure(); return config.buildSessionFactory(); }
This declaration results in the creation of two beans, an application scoped SessionFactory and a @RequestScoped Session.
This Session can be injected as follows:
@Inject Session session;
This managed session will automatically join the active transaction, and allows the use of EL in queries:
Hotel hilton = (Hotel) session.createQuery("select h from Hotel h where h.name=#{hotelName}").uniqueResult();
This is the last release of Seam Persistence that will use Weld Extensions. Weld Extensions has been renamed to Seam Solder, and future release will require Solder instead.
Key Links: