简体   繁体   中英

JDO no fields have been identified as primary key fields

I recently began to see JDO errors such as

Class X has been specified with an object-id class javax.jdo.identity.StringIdentity yet no fields have been identified as primary key fields.

My classes were using javax.persistence.Id annotations such as:

@Id
final private String key;

It turns out that this is due to marking key fields as final. To fix, it was simply necessary to change the declaration to something like the following:

@Id
private String key;

Leaving this here for the benefit of posterity!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM