Oh my... I was just going to write it, when you posted your message.
I was double checking everything according to the article you
mentioned, and that was it...
-----------------------------
3. (rule #3) Don't expect PC to be propagated when you call a remote
EJB even when the remote EJB happens to be running in the same JVM or
part of the same application.
-----------------------------
My EntityCacheLocal interface was, actually, @Remote (now I remember,
in the past, it was remote).
I am sorry for confusion, now it works like a charm :)
Thanks a lot!!
2007/7/4, Sahoo <Sahoo_at_sun.com>:
> Can you check if you have actually annotated LoanCacheServiceLocal as
> @Local or not?
>
> I tried using a simple test case, but could not reproduce the behavior
> you are reporting. I am using GlassFish V2 b52, but I don't think that
> matters. You have to supply a simple test case that demonstrates the
> problem.
>
> Thanks,
> Sahoo
>
> Witold Szczerba wrote:
> > Well, both session beans use injection to obtain entity manager:
> >
> > @PersistenceContext
> > private EntityManager em;
> >
> > Both session beans belong to the same EJB module which uses JTA. Looks
> > like I should not have
> > em.contains(entity) == false in TransactionServiceBean, but that is
> > what happens :/
> >
> >
> > 2007/7/4, Sahoo <Sahoo_at_sun.com>:
> >> How are you obtaining the em? Are you using the same persistence-unit in
> >> both the EJBs or not? Does this article [1] help you in resolving the
> >> issue?
> >>
> >> Thanks,
> >> Sahoo
> >>
> >> [1]
> >> http://weblogs.java.net/blog/ss141213/archive/2006/10/persistence_con.html
> >>
> >>
> >> Witold Szczerba wrote:
> >> > Hi there,
> >> > I have a situation, I do not know why, entity manager returns false in
> >> > the following case:
> >> >
> >> > there are two stateless session beans:
> >> >
> >> > @Stateless
> >> > public class LoanCacheServiceBean implements
> >> > LoanCacheServiceLocal, LoanCacheServiceRemote {
> >> > .........
> >> > public LoanCache getCache(Long loanId, Date date) {
> >> > .......
> >> > return loanCache; //<-- em.contains(loanCache) returns TRUE here
> >> > }
> >> > }
> >> >
> >> > @Stateless
> >> > public class TransactionServiceBean implements
> >> > TransactiondServiceLocal {
> >> >
> >> > @EJB
> >> > private LoanCacheServiceLocal loanCacheServiceBean;
> >> >
> >> > ..................
> >> > public void someMethod() {
> >> > LoanCache loanCache = loanCacheServiceBean.getCache(.....)
> >> > em.contains(loanCache); //NOW, loanCache IS FALSE, why?
> >> > }
> >> > }
> >> >
> >> >
> >> > As you can see, before getCache(...) returns, loanCache is managed by
> >> > entity manager, but inside someMethod() from another session bean,
> >> > that entity is not managed anymore. All is happening within same
> >> > transaction scope.
> >> >
> >> > When two entity managers are participating in the same transaction,
> >> > shouldn't they return the same result of em.contains(...) ?
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
>
>