If you don't want null Booleans, use boolean primitive instead.

With respect to default values, I don't think that the Isis metamodel looks
at the JDO @Column#defaultValue, no.  But you can specify a default value
in a couple of ways.

Assuming:

private boolean myFlag;
public boolean isMyFlag() { return myFlag; }
public void setMyFlag(boolean myFlag) { this.myFlag = myFlag; }

then you could (a) use a defaultXxx supporting method:


public boolean defaultMyFlag() { return true; }


or using a created() callback:

public void created() { setMyFlag(true); }

or (simplest) just setting the field to true:

private boolean myFlag= true;


Let us know if those work/don't work.

Thx
Dan



On 27 May 2016 at 13:52, Stephen Cameron <[email protected]> wrote:

> Hi
>
> I am wondering if its possible to make Boolean properties non-null and have
> a default value via JDO @Column annotations, e.g.
>
> @Column(allowsNull = "false", defaultValue = "true")
>
> Thus in the UI I have only true or false as options?
>
> At the moment the defaultValue seems to be ignored.
>
> Thanks
>

Reply via email to