users@glassfish.java.net

Re: Caching problem with build b58c-fcs?

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Fri, 24 Aug 2007 13:51:16 -0700

Hello Stephan,

Are you using TopLink Essentials (TLE) as the JPA provider? If yes, it caches
the entities as-is at the end of the transaction, and when you ask for it again
in another EM, you get not the database view, but the cached one. It's by design.

If your case is different, feel free to file a bug. If it's not, your only
solutions are to either disable cache, or refresh your objects calling
em.refresh on them (don't forget to use cascade-refresh on the relationships).

Regards,
-marina


glassfish_at_javadesktop.org wrote:
> Hello Marina,
>
>
>>Does it work differently with another build?
>
>
> I already had the problem with b85-rc1, but I wanted to verify it with the newest build. I did not recognize the problem with earlier builds, but I probably overlooked it.
>
>
>>If you
>>set or change relationships from one side, and it's a
>>bidirectional relationship, your application must
>>synchronize the other side as well. Or you can call
>>em.refresh() to get fresh data from the database.
>
>
> It's an unidirectional OneToMany relationship from A to B in my description. I'm calling em.find() with the primary key of the A entity in a stateless session bean, and the size of the list of B items for the OneToMany relationship is wrong. As I said, when I look into the database I can see that there are more B records for the A entity, and after a restart of Glassfish I get the expected result.
>
> Is there any further possibility for me to troubleshoot this in my environment? If not I will try to build an isolated reproduction scenario, but that will require a significant effort.
>
> Thanks
> Stephan
> [Message sent by forum member 'smuehlst' (smuehlst)]
>
> http://forums.java.net/jive/thread.jspa?messageID=232541
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>