-
1. Re: About Transaction
hookomjj Sep 26, 2005 9:52 AM (in response to nusa)"nusa" wrote:
Hi,
In the example under noejb, I don't see any declaration of transaction, i.e. session.beginTransaction(), transaction.commit() , or transaction.rollback().
Are they been replaced by @Begin and @End ?
Is there any relationship between @Begin and session.beginTransaction() ?
Do you have a plan to 'port' CaveatEmptor using Seam ?
Thanks.
There are plans to port caveatemptor and produce more 'tomcat' friendly demos for immediate deployment. -
2. Re: About Transaction
nusa Sep 26, 2005 10:22 AM (in response to nusa)Thanks for your reply Jacob.
But what about my questions on @Begin and @End ? -
3. Re: About Transaction
hookomjj Sep 26, 2005 11:33 AM (in response to nusa)"nusa" wrote:
Thanks for your reply Jacob.
But what about my questions on @Begin and @End ?
@Begin and @End are separate from User Transactions. @Begin and @End is the same as marking the begin and end of a Sub-Session scope (the way I look at it). So object that are conversation scoped, become part of the conversation that has begun, and at the time that @End is invoked, those conversation scoped objects will get cleaned up from the session.
For transaction details:
http://docs.jboss.com/seam/reference/en/html/configuration.html#d0e1597
-- Jacob -
4. Re: About Transaction
nusa Sep 26, 2005 11:46 AM (in response to nusa)One thing that I don't understand is why there is no beginTransaction(), commit(), or rollback() in RegisterAction.java or HotelBookingAction when calling the persist() method.
Am I missing something ? -
5. Re: About Transaction
gavin.king Sep 27, 2005 9:42 AM (in response to nusa)This example uses Seam-managed transactions (SeamExtendedManagedPersistencePhaseListener) so that one transaction spans UPDATE_MODEL_VALUES and INVOKE_APPLICATION, and a second spans RENDER_RESPONSE
-
6. Re: About Transaction
bran Sep 28, 2005 12:02 AM (in response to nusa)"gavin.king@jboss.com" wrote:
This example uses Seam-managed transactions (SeamExtendedManagedPersistencePhaseListener) so that one transaction spans UPDATE_MODEL_VALUES and INVOKE_APPLICATION, and a second spans RENDER_RESPONSE
hmm... the code shows that Seam does a begin/commit for each new request, regardless of the context, not giving programmers fine-control of transaction demarcation. What if I have a sesssion bean that takes PROPOGATION_NEVER transaction attribute, for example? I expected Seam would allow annotation based demarcation. -
7. Re: About Transaction
gavin.king Sep 28, 2005 12:11 AM (in response to nusa)If you need fine-grained declarative transactions, you should of course be using EJB components, not JavaBeans components. This is mentioned in the documentation.
Of course, fine-grained transactions are usually an exceptional case, not the common case.
So Seam supports both EJB declarative container-managed transactions and request-scoped Seam-managed transactions - which are a great implementation of the OpenSessionInView pattern - or a combination of both approaches. -
8. Re: About Transaction
nusa Sep 28, 2005 9:47 AM (in response to nusa)Gavin,
I would like to use Seam with Hibernate, not EJB3.
That means I have to use SeamExtendedManagedPersisteencePhaseListener. But this managed transactions only supports corse-grained transaction. If I want to use a fine-grained, I have to use EJB3.
Am I correct by saying, that if I want use a fine-grained transation, use EJB3, not Hibernate ? -
9. Re: About Transaction
gavin.king Sep 28, 2005 9:53 AM (in response to nusa)Well, actually, it's easily possible to use Hibernate inside the JBoss EJB3 container. JBoss EJB3 can inject a Session instead of an EntityManager.
-
10. Re: About Transaction
gavin.king Sep 28, 2005 9:54 AM (in response to nusa)Or, you could use SessionFactory.getCurrentSession() in any EJB3 container, not just in JBoss EJB3.
-
11. Re: About Transaction
nusa Sep 28, 2005 10:33 AM (in response to nusa)"gavin.king@jboss.com" wrote:
Well, actually, it's easily possible to use Hibernate inside the JBoss EJB3 container. JBoss EJB3 can inject a Session instead of an EntityManager.
Gavin,
If you have a sample code, in your blog, that would be great :) -
12. Re: About Transaction
nusa Sep 28, 2005 10:33 AM (in response to nusa)"gavin.king@jboss.com" wrote:
Or, you could use SessionFactory.getCurrentSession() in any EJB3 container, not just in JBoss EJB3.
Gavin,
Again, if you have a sample code, in your blog, that would be great :)