Newbie : How to return the auto-generated ID



I am new to this community, as well as JPA and ObjectDB. I want to read the auto-generated ID when I persist a new entity (with @Id @GeneratedValue annotations applied). I am following the following link :



The id is available in the id field so you can simply access it.

By default, however, the allocated value is available only after commit or flush and not after persist.

If you need to have the id available earlier (immediately after persist) - you have to switch to sequence or table value generation strategy.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login