JPA2——EntityManager.detach 在哪里?
我在几个地方读到 JPA2 将支持实体管理器上的分离方法调用。我正在使用 Hibernate 3.5.1-FINAL 和 Spring 3.0.2-RELEASE 作为 Maven 依赖项运行——从 JBoss 存储库中获取。
这还不够吗?
也许问题出在我的 javax.persistence.EntityManager 接口定义上。我需要更新javax吗?如何做到这一点?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您甚至不需要将 hibernate-jpa-2.0-api 1.0.0.FINAL 声明为依赖项,您可以从 hibernate-entitymanager 3.5.1.Final 中传递它。运行
mvn dependency:tree
可以确认这一点。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.好吧,我想通了。我的 Maven 项目(在顶层)依赖于 javax.persistence persistence-api 1.0。我把它拿出来并用 hibernate-jpa-2.0-api 1.0.0.FINAL 和 viola 替换它......我已经分离了!
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!