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

And this application managed EntityManager will give this conversational
handling of transactions even when used inside @Stateless EJBs? and if it
can be used on @Stateless EJBS... Can you offer any insights on why Gavin
thinks it can not be used with @Stateless EJBS? (Or am I plain interpreting
him wrong?)


James Sutherland wrote:
> 
> 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,
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Howt-to-have-Extended-persistence-context-for-%40Stateless-EJBs-and-POJOS-tp23870645p23967796.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top