Hi all,


I'm looking for some information to use java.util.UUID as a <Meaningful Primary 
Key > as stated in 
https://cayenne.apache.org/docs/3.0/primary-key-generation.html .



I've planned to use a Listener onPreUpdate to initialize the value.

Every tries shown an Integer used in my VARCHAR column, and my UUID key unused 
(but a sequence value instead)

Modeler PK generation is < default >.
I'm using it that way

@PostAdd(Audit.class)
public void postAdd(Audit object) {
   object.setUuid(UUID.randomUUID());
   object.setCreatedBy("ME");
   object.setCreationDate(new Date());
}

Most of objects extends this abstract super class Audit.


Listerner is added to context at startup and  triggered as expected.



I'm using 4M3.


Do you know how to deal with this ?

One more thing : for all abstract super classes, should I duplicate properties 
on the overiding objects because without doing it values seems not persisted  ?

Regards
Fred.

Reply via email to