Did you override equals method for that class? Unless you did you cannot
expect it to work correctly.
On Sat, Aug 22, 2009 at 3:54 PM, measwel <marek_karczewski_at_yahoo.com.au>wrote:
>
> Hallo. The same thing happens, when using .equals. That seems not to be the
> problem. But, maybe I have a solution:
>
> Now instead of accessing the user's favorite collection directly, I first
> get the user's reference from the Entity manger like so:
>
> public Wuser getUser() {
>
> EntityManager em = null;
> em = getEntityManager();
>
> // get the current user
> ExternalContext extContext = getContext().getExternalContext();
> Wuser user = (Wuser) extContext.getSessionMap().get("user");
> // get the user from the entity manager
> user = em.getReference(user.getClass(), user.getId());
>
> return user;
> }
>
> This seems to work; I have not gotten the error up to now (fingers
> crossed).
> I supposed that the user object got detached somehow and by using the above
> method, I get a new reference to a manged instance. Could this have been
> the
> source of my problems? Is it normal to get references to objects which
> properties you want to use from the entity manager?
>
> Thank you,
> MPK
> --
> View this message in context:
> http://www.nabble.com/JPA-error-tp25092854p25094044.html
> Sent from the java.net - glassfish persistence mailing list archive at
> Nabble.com.
>
>