You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Stephen Cameron <st...@gmail.com> on 2016/05/27 12:52:40 UTC

Boolean properties, setting a default value

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

Re: Boolean properties, setting a default value

Posted by Stephen Cameron <st...@gmail.com>.
using boolean for properties doesn't make any difference but setting
@Column#allowNulls="false" has the desired effect too remove Null (black
square) as an option in the GUI

using boolean for parameters does limit the GUI to a binary choice.

Will try all the default setting options once I know what to set it too,
but using the last option doesn't do anything, the other two will no doubt
give a result.

Thx

On Sat, May 28, 2016 at 3:27 AM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> 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 <st...@gmail.com>
> 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
> >
>

Re: How does Apache Isis deal with "eventual consistency" of databases like Cassandra

Posted by Andrew Voumard <an...@melbpc.org.au>.
Hi Dan,

Many thanks for the info. I will post any findings after it has been tried out.

Thanks
Andrew

________________________________________
From: Dan Haywood <da...@haywood-associates.co.uk>
Sent: Sunday, 29 May 2016 4:08 PM
To: users
Subject: Re: How does Apache Isis deal with "eventual consistency" of databases like Cassandra

Hi Andrew,

This will depend on how DataNuclues itself is configured. Isis will pass
thru all config properties with a certain prefix
("isis.persistor.datanucleus.impl", I think it is) through to DN, so I
imagine that you could use that to set the behaviour.

Caveat : I'm not aware of anyone in the community using the
Isis/dn/cassandra combination. There are some who have used the framework
using Neo4J; one of two minor changes were required to the framework to
enable that. Can't tell you if it will work out "of the box" with cassandra
or whether similar changes might be required.

HTH,
Dan
On 28 May 2016 23:50, "Andrew Voumard" <an...@melbpc.org.au> wrote:

> Hi,
>
> I see that DataNucleus is supported, and that Cassandra is one of the
> databases under that. Cassandra runs on the concept of "eventual
> consistency", where some errors/exceptions occur, that differ from a
> relational DB, see:
>
> http://www.datastax.com/dev/blog/cassandra-error-handling-done-right
>
> Will Apache Isis retry, fast fail, etc on the errors relating to"eventual
> consistency", described in the link above ?.
>
> Thanks
> Andrew
>

Re: How does Apache Isis deal with "eventual consistency" of databases like Cassandra

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Andrew,

This will depend on how DataNuclues itself is configured. Isis will pass
thru all config properties with a certain prefix
("isis.persistor.datanucleus.impl", I think it is) through to DN, so I
imagine that you could use that to set the behaviour.

Caveat : I'm not aware of anyone in the community using the
Isis/dn/cassandra combination. There are some who have used the framework
using Neo4J; one of two minor changes were required to the framework to
enable that. Can't tell you if it will work out "of the box" with cassandra
or whether similar changes might be required.

HTH,
Dan
On 28 May 2016 23:50, "Andrew Voumard" <an...@melbpc.org.au> wrote:

> Hi,
>
> I see that DataNucleus is supported, and that Cassandra is one of the
> databases under that. Cassandra runs on the concept of "eventual
> consistency", where some errors/exceptions occur, that differ from a
> relational DB, see:
>
> http://www.datastax.com/dev/blog/cassandra-error-handling-done-right
>
> Will Apache Isis retry, fast fail, etc on the errors relating to"eventual
> consistency", described in the link above ?.
>
> Thanks
> Andrew
>

How does Apache Isis deal with "eventual consistency" of databases like Cassandra

Posted by Andrew Voumard <an...@melbpc.org.au>.
Hi,

I see that DataNucleus is supported, and that Cassandra is one of the databases under that. Cassandra runs on the concept of "eventual consistency", where some errors/exceptions occur, that differ from a relational DB, see:

http://www.datastax.com/dev/blog/cassandra-error-handling-done-right

Will Apache Isis retry, fast fail, etc on the errors relating to"eventual consistency", described in the link above ?.

Thanks
Andrew

Re: Boolean properties, setting a default value

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
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 <st...@gmail.com> 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
>