Hi, Am using EJB3.0 Entity on WL 10.3 . The application is designed in ValueObject model i.e Entities are not directly passed to client but converted into value objects and then sent to client. I cannot change this design now. Value object also has primary key (id) column . My requirement is to create an entity and send VO back with id of newly created entity set.
Now I understand , id is not generated untill the entity is inserted into database.. At the end of method when i convert Entity to VO , I donot get the primay key as the transaction is not committed yet. So to overcome this problem , I have user em.flush() ... and then I could get the key.. I understand its a bad practice to use flush .. but can anyone suggest how else can I get the system generated primary key at the end of method and set it back in VO ? Thanks Himadri -- View this message in context: http://openjpa.208410.n2.nabble.com/Need-id-to-set-in-VO-tp5481138p5481138.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
