Hi,
In Hibernate it is possible to have an Id assigned by the application, is possible too with Hibernate Annotation and Hibernate EM.
In fact, I would like to assign myself the Id for an entity, because those entities are master data and I would like to the same ids accross different databases.
If I use only @Id, I got an error saying that my entity is transient (normal)
if I use
Code:
@Id
@GeneratedValue(generator="app-assigned")
@GenericGenerator(name = "app-assigned", strategy = "assigned")
I got the error saying that a detach entity passed to persist (normal).
Then I use merge, but in this case I have again the error transient.
So, could someone tell what is the @Id setup I have to use to set the Id myself (in my application)?
Thanks
Dominique