Hi Sanne,
s.grinovero wrote:
Long may be null, long not;
Hibernate knows that if the PK is null it is a new entity that needs a new PK.
thanks, I haven't taught about detecting unset keys before. Even zero may be used for long also, if the generator wouldn't use the zero value.
Quote:
Quote:
If I have already overridden equals and hashcode to fulfil collections requirements, do I have to use the used properties (as compound key) in the database, or can I use a synthetic id?
Much has been written on this topic, I would suggest you to read one of the Hibernate books as there are many strategies and implications you should be aware of.
Do you know where I can find a short summary?
Most important is for me, if overridden equals an hashcode forces a natural key, or not.
But if I want to have a database wide unique (according to equals) instance and not only application wide (e.g. cause of Set restrictions) unique instance, I have to use the natural key, or?
Thanks.
Greetings Michael