I would like to make an unmanaged entity manageable in a different persistence context. I read that this can be done by merging:
em.merge(user);
But if I do this, it is not added to the context:
boolean isManaged = em.contains(user);
always false.
Even if I do the following:
User dbuser = em.find(User.class, user.getId()); em.merge(user); boolean isManaged = em.contains(user);
dbuser and user are exactly the same.
What am I doing wrong?
I am using JPA, MySql DB, JBoss EAP 6.1
source share