10.4. Using the JPA "delegate"

The EntityManager interface lets you access a vendor-specific API with the getDelegate() method. We recommend using Hibernate as your vendor, and org.hibernate.Session as your delegate interface, but if you require a different JPA provider, see Section 28.2, “Using Alternate JPA Providers” for further information.
Regardless of your vendor, there are several approaches to using the delegate in your Seam components. One approach is:
@In EntityManager entityManager; 
@Create public void init() { 
  ((Session)entityManager.getDelegate() ).enableFilter("currentVersions");
}
If you, like most Java users, would rather avoid using typecasts, you can also access the delegate by adding the following line to components.xml:
<factory name="session" scope="STATELESS" auto-create="true" 
         value="#{entityManager.delegate}"/>
The session can now be injected directly:
@In Session session;

@Create
public void init() {
  session.enableFilter("currentVersions");
}