You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Markus Reich <ma...@markusreich.at> on 2013/09/17 12:09:33 UTC

DB default values

Hi,

what is the best practice with db's default values?
Is it good style to copy the logic into the constructor of the extended
data object?

Meex

Re: DB default values

Posted by John Huss <jo...@gmail.com>.
In regard to which fields you set, it really doesn't matter - the Java
defaults are completely separate from the DB defaults, so it's up to you.
 The DB defaults are not utilized by Cayenne at all.

John


On Tue, Sep 17, 2013 at 8:11 AM, Michael Gentry <mg...@masslight.net>wrote:

> Hello Markus,
>
> You should create an onPostAdd callback in the modeler, generate the
> class(es) again, then implement the method (setting the default values you
> want) in the data object subclass.
>
> mrg
>
>
>
> On Tue, Sep 17, 2013 at 6:09 AM, Markus Reich
> <ma...@markusreich.at>wrote:
>
> > Hi,
> >
> > what is the best practice with db's default values?
> > Is it good style to copy the logic into the constructor of the extended
> > data object?
> >
> > Meex
> >
>

Re: DB default values

Posted by Michael Gentry <mg...@masslight.net>.
Hello Markus,

You should create an onPostAdd callback in the modeler, generate the
class(es) again, then implement the method (setting the default values you
want) in the data object subclass.

mrg



On Tue, Sep 17, 2013 at 6:09 AM, Markus Reich
<ma...@markusreich.at>wrote:

> Hi,
>
> what is the best practice with db's default values?
> Is it good style to copy the logic into the constructor of the extended
> data object?
>
> Meex
>