posted 15 years ago
Hi,
I use Hibernate through JPA. The database is MySQL 5.0
I have an Entity with generated key. I create an object and perform merge(). JPA's way to give me the generated key is giving me the whole new object as a return value.
Is there a way to let Hibernate update my "old" object (i.e., the one passed to merge()) ? To have just
User = new User();
<jpa>.merge( user );
and now the user now has the ID set.
The reason I'm looking for this is that I would like to keep the old DAO API. The need to get the new object would cause much much code updates.
Thanks for tips,
Ondra