[jboss-user] [JBoss Seam] - Re: Can Seam work with no ejb3 but with Hibernate ORM?

pgrillo do-not-reply at jboss.com
Wed Dec 13 13:32:02 EST 2006


Sorry, i "thought" i was monitoring this thread, so missed the info.

Since then we have decided that Seam is an excellent way to go with our thin client implementation of our system.  I'm trying to get my hands around whether and how we can integrate our current hibernate 3.2 based component into Seam, without having a dependency on Seam, since our component will also be used in other applications that are not thin client.

What we have:


  | 
  | Set of Pojo Business Objects, quite robust.
  | Set of DAOs pretty much consistent with Christian's approach in Java Peristence with Hibernate
  | DAOs use getCurrenSession
  | Currently use "hibernate.current_session_context_class=managed"
  | Currently using our own filterservlet, would move to Seam handling it.
  | HibernateFactory is built dynamically by our own Factory component, where the DAO can reference it
  | Use Java 5 and Tomcat 5.5.9, as well as weblogic.
  | We do not currently use JTA or EJB3, or even JNDI
  | 
  | 
  | 
  | So we now wish to use Seam.  Our above DAOs would be readily available to any seam component that needs it, simply by accessing our Factory.  Generally speaking, the session is not as interesting or important to our components as the DAOs.  That is injecting the session might be nice, but injecting the session into a DAO makes DAO dependent on seam injection.
  | 
  | What i need is simply (or not so simply) to 
  | 
  |   | have Seam manage the hibernate session in a way that it continues to be available to our DAOs, and also, if possible, to allow  transaction demarcation when needed at least where Seam intercepts and manages the session
  |   | 
  | 
  | The excerpt below seems to show how to do this.  However, it says "if we want a Seam managed Hibernate Session to be available" which is okay, but does this imply that doing the following also acheives my above goal?  Hibernate manages the lifecycle of the session, and also provides access to the hibernate session to our DAOS (getCurrentSession?)  "without" injection, since i do not want injection inside the DAOs?
  | 
  | 
  | anonymous wrote : 
  |   | 9.5.2. Using a Seam-managed Hibernate Session
  |   | 
  |   | We will also need to configure a managed session if we want a Seam managed Hibernate Session to be available via injection.
  |   | 
  |   | To configure our Seam component, as usual, we use components.xml:
  |   | <component class="org.jboss.seam.core.Hibernate"/>
  |   |   | <component name="bookingDatabase"
  |   |   |           class="org.jboss.seam.core.ManagedHibernateSession">
  |   |   |     <property name="sessionFactoryJndiName">java:/bookingSessionFactory</property>
  |   |   | </component>
  |   |   | 
  | 
  | 
  | 
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993526#3993526

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993526



More information about the jboss-user mailing list