JPA / OpenJPA 所有行中的值相同
我在使用 OpenJPA 时遇到问题,
我尝试读取表中的所有行,但主键始终具有相同的值(值 = 0)!?!?!?
for (Object o : em.createQuery("select x from AnnouncementsEntry x")
.getResultList()) {
//alway returns "0" in every row
long id = ((AnnouncementsEntry) o).getEntryId();
我的条目:
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long entryId;
I have a problem with OpenJPA
I try to read all rows from a table but the primary key has always a same value(value = 0)!?!?!?
for (Object o : em.createQuery("select x from AnnouncementsEntry x")
.getResultList()) {
//alway returns "0" in every row
long id = ((AnnouncementsEntry) o).getEntryId();
my entry:
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long entryId;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这已经很老了,但我相当确定问题在于您的实体是如何增强的。您使用的 Eclipse 插件很可能存在一些问题。
对于遇到此问题的其他人,请查看 OpenJPA 增强文档。
This is way old, but I'm fairly certain that the problem was how your Entities were enhanced. More than likely you used an eclipse plugin that has some problems.
To anyone else having this problem, please checkout the OpenJPA enhancement docs.