I came across this weird issue while using EclipseLink 2.0 with JPA 2.0. It isn't actually that complicated as it looks. Though I spent lot of time figuring out whether any objects have null id or negative id. Finally figured out that, The database had rows with id as '0'. By default EclipseLink treats zero ids as null. I don't
Simple fix is to tell EclipseLink to treat '0' as a valid id and not null. It can be done by specifying the property in persistence.xml
In persistence.xml add the following property to get rid of this exception.
<property name="eclipselink.allow-zero-id" value="true"/>
This property simply tells EclipseLink to treat '0' as a valid primary key instead of null.
Simple fix is to tell EclipseLink to treat '0' as a valid id and not null. It can be done by specifying the property in persistence.xml
In persistence.xml add the following property to get rid of this exception.
<property name="eclipselink.allow-zero-id" value="true"/>
This property simply tells EclipseLink to treat '0' as a valid primary key instead of null.
Thanks a lot.. Straight n simple. It worked !!
ReplyDeleteA very useful tip ¡thanks!
ReplyDeleteA little jewel. thanks for sharing it.
ReplyDeleteThank you man, it works!!!
ReplyDeleteWow, thank you so much.....i spend a few hours looking for that problem...
ReplyDeleteTwo and a half years after your post I have encountered the problem and cannot thank you enough for for the time I could not afford to waste that you saved!
ReplyDeleteit is okay thank you
ReplyDeletethanks a lot !!
ReplyDelete;)