Hi!
I have found a few answers to this, but I kindof did not get it:
I need to make a copy of an entity, change a few values and then save that object with a new id (resulting in an insert rather than an update). Maybe my problem is that the id is a long (and generated in the database)
I cant implement a .clone method.
If I "evict" the original object, and save it, it will result in an error because the id (obviously) is already in use. If I change the id (which is a long) manually to "0" or "-1" (which I thought would be hibernate for "new") hibernate will just save it with the id "0" and the next iteration obviously that will through an error.
So, how can do that, dont get it!??
Thanks a loads!
Cheers!
|