Joshua van Aalst’s blog

July 5th, 2007

JEE5: Hibernate + JBoss = detached entity passed to persist

Posted by Joshua van Aalst in Java and Web Development

Just a quick heads up….

If you are using the above combination and you get the error

“detached entity passed to persist”

This could mean that you are getting a new entity manager not the one in your transaction.

Make sure you do NOT call getEntityManager() but just use entityManager as an instance variable.

Java EE5 will inject the correct entity manager for you to use!

Hope that helps,
Josh

Leave a reply

You must be logged in to post a comment.