Hi all,
My problem is : I've a class A mapped with the following annotations : @Id @GeneratedValue(generator = "uddi-id") @GenericGenerator(name = "uddi-id", strategy = "myapp.persistence.util.UDDIIdentifierGenerator")
If I save an object of type A with Id = null, all is ok, id is generated by my custom generator and object is persisted.
The problem is when I try to persist an object of type A with an application (and not an hibernate) generated Id. In this case hibernate try to update this object instead of creating it (the saveOrUpdate case) or persist it with a generated id instead of my application created id (the merge/persist case).
So my question is : is it possible to persist the same type of object (with the same annotation), once with a generated id (if the id of the object to persist is null) and once with an application assigned id ? And how could I do that ?
Thanks.
|