草庐IT

java - 持久性错误消息 : An instance of a null PK has been incorrectly provided for the find operation

coder 2024-03-06 原文

我正在尝试使用 Netbeans 7.01 来遵循有关 JSF 2.0 和 JPA 的教程。我正在使用 oracle XE 和 JDBC_6。我使用实体向导中的 JSF 页面来生成我的 JSF 页面。一切正常,因为我可以从数据库中检索数据并显示它们。但是,当我尝试在数据库中创建或更新记录时,出现此错误:

An instance of a null PK has been incorrectly provided for the find operation

这是怎么引起的,我该如何解决?

最佳答案

这基本上意味着您执行了以下操作:

Entity entity = em.find(Entity.class, null);

注意这里PK是null。要解决您的问题,只需确保它不是 null

关于java - 持久性错误消息 : An instance of a null PK has been incorrectly provided for the find operation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8301107/

有关java - 持久性错误消息 : An instance of a null PK has been incorrectly provided for the find operation的更多相关文章

随机推荐