max wrote:
why does your object *need* the synthetic only persistence relevant id ?
Max, I am sorry, but I dont think I follow what you mean by "synthetic only persistent id".
Assuming that I have a simple POJO object model and that I want to use in two different usecases (believe me, in my case these two distinct usecases are important):
(1) Transient POJO. No database persistence, but only inmemory use (simulation, testing, etc).
(2) Persistent POJO. Database persistence using Hibernate (or any other POJO ORM).
Ideally I would like to be able to cover (1) as the default for my POJO model, but I would still like to have the freedom to create my (2) mappings independent of (1). Ideally, I wouldnt want to modify my POJO code to acomodate (2).
My understanding so far tells me that the only way to cover usecase (1) and (2) wihtout code changes, is to assign my own unique id at POJO instantiation time and use the "assigned ids" in my Hibernate mappings. These ids must be unique accross usecase (1) and (2) so the easiest would be to use an UUID.
thanks again!
-- yuri