I want to use SEAM Framework with Hibernate but do not want to use EJB. I cannot use EJB.
First question is, can I use EntityManager? or is EntityManager a part of EJB?
How can I get access to use Hibernate in my SEAM component?
Thanks, Philip
With Seam, you can use either Hibernate or JPA (EntityManager). It works regardless of EJB. You can use plain POJO if you want.
How can I get access to use Hibernate in my SEAM component ?
Here goes Hibernate settings WEB-INF/components.xml
SessionFactory settings
<persistence:hibernate-session-factory name="sessionFactory" cfg-resource-name="app.cfg.xml"/>
Where app.cfg.xml is placed in the root of the classpath
Session settings
<persistence:managed-hibernate-session name="session" hibernate-session-factory="#{sessionFactory}" auto-create="true"/>
TransactionManagement settings
<!--It takes care of calling begin and commit in the underlying Transaction API-->
<!--Here a Hibernate Transaction API-->
<tx:hibernate-transaction session="#{session}"/>
To inject your Hibernate Session you can use
/**
* Seam lookup Seam enabled components Through its referenced name - session
*/
private @In Session session;
Keep in mind Seam works with any MVC framework although it uses Java Server Faces by default. You can create even your own MVC capabilities if you want. Take a look at JBoss Seam Tuto