JPAContainer: get created id (object)

How can I retreive the object which I just have created over JPAContainer?

For example:
JPAContainer newContainer = JPAContainerFactory.makeBatchable(Address.class, “mydb”);
// I have to remove autocommit
newContainer.setAutoCommit(false);
newContainer.setBuffered(true);
newContainer.addEntity(new Address());

I need the id of new address.

newContainer.addEntity() return UUID, I have no idea where I can use it.
newContainer.lastItemId() is not good idea to use it (when the table is empty this can throw ArrayOfBoundException).

Hey freekode,

Perhaps
19.4.2. Creating and Accessing Entities
of
https://vaadin.com/book/-/page/jpacontainer.usage.html
might help?

No. Ok, I try to describe:

Address newAddress = new Address();
newContainer.addEntity(newAddress);

and I neeed the id of newAddress, how can I get it?


https://vaadin.com/book/-/page/jpacontainer.usage.html

well, in the first message, I wrote two additional lines:
newContainer.setAutoCommit(false);
newContainer.setBuffered(true);
it means, that after calling addEntity method, the entity will not be in database, it just saved in memory, and in this situation (as I wrote before), addEntity method return UUID, this not id from database, this is id of the entity in memory (I dont need it).
And for my situation this example is not valid.

Perhaps this will help?
https://vaadin.com/forum/#!/thread/1170858/7589964