开发者

JPA / OpenJPA Same value in all rows

开发者 https://www.devze.com 2023-01-15 21:01 出处:网络
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)!?!?!?

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;
开发者_如何学运维


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号