users@glassfish.java.net

Re: Persistence Context in JPA

From: <glassfish_at_javadesktop.org>
Date: Thu, 03 May 2007 11:01:21 PDT

Hi Sahoo,
> Propagation of JTA transaction across session beans
> is independent of
> use of JPA. Since you use different EMFs in those
> session beans, you
> would be using different persistence contexts in each
> of those bean's
> context. Did it answer your question?

That's my question, In the case I have different PC among locally caller and called SFSB. But the propagation requires the same PC, right? In other words, If a stateful session bean with an extended persistence context calls a stateful session bean with a different extended persistence context in the same transaction, an IllegalStateException would be thrown.

Am I missing something here, as then I will not be able to use a different PC of an EMF configured for different data source.

 Take a look at
> [1] for an example
> of PC propagation.

I had a look at your explanation in the blog, I must say it is very informative, my question is related somewhat to rule#5. I guess, your example uses the same datasource in the transaction of ReportServlet where it calls the UCM Bean.

With Regards,
Mayank



>
> Thanks,
> Sahoo
> [1]
> http://weblogs.java.net/blog/ss141213/archive/2006/10/
> persistence_con.html
> glassfish_at_javadesktop.org wrote:
> > As per JPA Spec section 5.6.3, "A single
> persistence context may correspond to one or more JTA
> entity manager instance (all associated with the same
> entity manager factory).
> >
> > Now, If I require a JTA transaction to be
> propagated among Stateful sesion beans and each
> session bean is using different datasources (hence
> having different persistence-units in same or
> different 'persistence.xml' file and hence different
> EMFs)
> >
> > How am I going to acheive this using JPA?
> >
> > With Regards,
> > Mayank
> > [Message sent by forum member 'mayankmishra'
> (mayankmishra)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=2152
> 18
> >
> >
> ------------------------------------------------------
> ---------------
> > To unsubscribe, e-mail:
> users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail:
> users-help_at_glassfish.dev.java.net
> >
> >
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail:
> users-help_at_glassfish.dev.java.net
[Message sent by forum member 'mayankmishra' (mayankmishra)]

http://forums.java.net/jive/thread.jspa?messageID=215414