cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <>
Subject Re: Convert Oracle Type NUMBER to java.lang.Boolean
Date Tue, 23 Apr 2013 00:20:50 GMT
Yes, I do that all the time: integer in the database and boolean in the model. On the plus
side when you (inevitably it seems) discover that your boolean actually needs 4 values, migrating
to an enum is simple since you can leave the database alone and just change the model.

Remember the good old days when sex was just male/female/null?


On 23/04/13 1:23am, Andrus Adamchik wrote:
> Actually this should just work. No hacks are needed. But it should be mapped as NUMBER
on the DbEntity side, and as java.lang.Boolean - on the ObjEntity side. If it doesn't, it
is a bug that we need to fix.
> Andrus
> On Apr 22, 2013, at 4:51 AM, Markus Reich <> wrote:
>> Hi,
>> I've a problem with using boolean values in my cayenne class.
>> In Oracle DB the field has type NUMBER and contains only 0 or 1 as value.
>> Now I thought I can map this to a Boolean?
>> I came to this because it also works when I select with an Expression:
>> ExpressionFactory.matchExp(MiiPickingcontainer.DELETED_PROPERTY, false));
>> But when I make a check with getDeleted()==false, it doesn't work as
>> getDeleted() always returns false?
>> What would be the best approach to transform a Oracle NUMBER to a Boolean?
>> Markus

Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message