cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Øyvind Harboe" <oyvind.har...@zylin.com>
Subject Re: UUID as primary key
Date Tue, 01 Aug 2006 11:23:26 GMT
On 7/22/06, Andrus Adamchik <andrus@objectstyle.org> wrote:
>
> I see. That makes sense - each DataContext in a nested context chain
> would create its own instance of object and transition it through the
> lifecycle. So technically it is still called once per object
> instance. However the fact that ID can be passed from a peer object
> in the upstream context requires an extra check. E.g.:
>
>   public void setPersistenceState(int state) {
>     super.setPersistenceState(state);
>
>     if (state == PersistenceState.NEW && getObjectId() == null) {
>       setId(UUID.randomUUID());
>     }
>   }


That didn't work for me. getObjectId()  is never null when
setPersistanceState() is called, AFAICT.

Otherwise, it seems to work fine though.



-- 
Øyvind Harboe
http://www.zylin.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message