views:

218

answers:

2

I read in several places that JPA2 will support a detach method call on Entity Manager. I am running with Hibernate 3.5.1-FINAL and Spring 3.0.2-RELEASE as Maven dependencies -- snagged from the JBoss repository.

Isn't this enough?

Perhaps the problem is with my javax.persistence.EntityManager interface definition. Do I need to update javax? How does one do this?

A: 

Well, I figured it out. My maven project (at the top level) had a dependency on javax.persistence persistence-api 1.0. I took this out and replaced it with hibernate-jpa-2.0-api 1.0.0.FINAL and viola...i have detach!

HDave
+1  A: 

You don't even need to declare hibernate-jpa-2.0-api 1.0.0.FINAL as dependency, you get it transitively from hibernate-entitymanager 3.5.1.Final. Running mvn dependency:tree would confirm this.

Pascal Thivent
You are right, but I have hibernate-entitymanager as a runtime scope dependency just to be extra sure I don't have any hibernate specific code. THerefore I needed to declare the api as a compile scope dependency.
HDave