Yes, this is a primary key column.

If possible - please point me to an optimal way of initializing the column
for new objects.

On Fri, Jul 20, 2012 at 6:41 PM, Andrus Adamchik <and...@objectstyle.org>wrote:

>
> On Jul 20, 2012, at 2:31 PM, Kanwar Manish wrote:
>
> > Column is of type varchar(36) in PostgreSQL and it is mapped as UUID in
> the
> > cayenne mapping.
>
> Is this a PK column?
>
> > In the constructor of the db class I am initiating the id.
> > Values are being saved perfectly fine.
> >
> > "
> > public class UserMaster extends _UserMaster {
> >
> >    public UserMaster() {
> >        this.setUserMasterId(UUID.randomUUID());
> >    }
> > .........}
>
> This is wrong, or at least suboptimal. Constructor is called not only when
> a NEW object is created, but also when an existing one is selected from DB.
> You need to use a different initialization mechanism, such as PostAdd
> lifecycle callback or something like it. But this is an aside.. It doesn't
> seem related to the issue.
>
> Andrus
>
>

Reply via email to