According to spec, the object returned from the find method is detached object. When I run the same on JBOSS, i get it managed. This is being checked using Entity Manager's contain method. I am using Transaction scoped context
Hi, the object will result as detached if you are not in a transaction. Consider that if you return the object from an ejb method with its own transaction, this could happen. Can you post your code?
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void findUser() { em.getTransaction(); User user = em.find(User.class, 2); System.out.println(user.getName()); System.out.println(em.contains(user)); }