Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Howt to have Extended persistence context for @Stateless EJBs and POJOS

Not sure I understand but you seem to want to ignore the container JPA
transactions correct?

Normally when using EJB any work you do inside a JTA transaction will be
committed when that JTA transaction commits, normally at the end of the
SessionBean method, or when the JTA transaction is committed explicitly. 
You seem to want your EntityManager transaction to span multiple server
calls, and multiple JTA transactions.  For this I think you would want to
use an application managed EntityManager.  Either do not use JTA at all,
just use EntityManager transactions and commit whenever you desire, or use
joinTransaction() when you wish to commit to commit along with the active
JTA transaction.


Francisco Peredo wrote:
> 
> Hi!
> I while ago I posted here asking for a way to emulate FlushMode.MANUAL in
> EclipseLink for support
> of conversational behavior, and back then I 
> http://dev.eclipse.org/newslists/news.eclipse.rt.eclipselink/msg00060.html
> was told  that:
> 
> 
> Doug Clarke wrote:
>> 
>> Making changes within a entity manager acting as an extended persistence
>> context where the complete set of conversation changes are committed in a
>> single transaction does make sense and is very common. JPA supports this
>> through its support for joining of an extended persistence context with a
>> transaction. 
>> 
> 
> So I went and asked about that in on the 
> http://www.seamframework.org/Community/InjectionIntoEntityBeans#comment79802
> Hibernate side ... And got 
> http://www.seamframework.org/Community/InjectionIntoEntityBeans#comment79824
> this answer  stating, basically that extended persistence contexts get
> broken because:
> 
> 
> Gavin King wrote:
>> 
>> [...]if I call a stateless session bean, the persistence context does not
>> propagate, so any work it does is either committed non-atomically (i.e.
>> immediately) or not at all. Work done by stateless session beans is not
>> able to form part of the atomic long-running optimistic "transaction".
>> 
> 
> Now... am not sure I really understand this... but my interpretation is
> that plain JPA only supports extended persistence contexts  in @Stateful
> EJBs, and if I try use an extended persistence context in @Stateless EJBs
> (or in plain POJOs working in a "Stateful-like" way thanks to not-standard
> the services provided by Spring or Seam) it will break and fail. 
> 
> Did I understood correctly? And if I did : is there an EclipseLink
> specific extension to provide something like an extended persistence
> context  for POJOS (and/or  @Stateless EJBs)?
> 
> Regards,
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Howt-to-have-Extended-persistence-context-for-%40Stateless-EJBs-and-POJOS-tp23870645p23964812.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top