[jboss-user] [JBoss Seam] - Re: Extended Persistence Context without EntityManager

dan.j.allen do-not-reply at jboss.com
Mon Mar 19 02:06:08 EDT 2007


Okay, I'm the ass.  Sorry for wasting your time. Chapter 8.3 describes this very clearly with the Seam-managed SessionFactory and FlushMode feature of Hibernate.  I also didn't read close enough (or slow enough) to realize that the session-factory-jndi-name attribute is actually the name of the session factory in the hibernate.cfg.xml file.  Intuition wanted to mess with my head.

For those of you just joining us, turn your attention to this quote from the reference manual:

anonymous wrote : Seam lets you specify FlushModeType.MANUAL when beginning a conversation.  ...changes will not be flushed to the database until we explicitly force the flush to occur.

and this code

components.xml
<core:hibernate-session-factory name="hibernateSessionFactory"/>
  | <core:managed-hibernate-session name="hibernateSession" auto-create="true" session-factory-jndi-name="WhateverYouLike"/>

hibernate.cfg.xml
<session-factory name="WhateverYouLike">
  |   <!-- props -->
  | </session-factory>

So what this is saying is that Seam can manage your hibernate sessions by using a Seam-managed Hibernate SessionFactory.  If you inject that Session into a conversation-scoped Seam component, you now have a session-per-conversation for free!  Using FlushMode.MANUAL you can even choose to delay the flushing of the session to the database across many different transactions.

Now, the challenge is for me to get this working in my little sandbox.

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

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



More information about the jboss-user mailing list