Hi Hugi,

If you are using 3.1, we appear to be missing the documentation for
ExtendedTypes at the bottom of this page:

http://cayenne.apache.org/docs/3.1/cayenne-guide/customizing-cayenne-runtime.html

If you are using 3.0 (and it may be the same in 3.1, I've just not done it
there yet):

http://cayenne.apache.org/docs/3.0/extended-types.html

Once your extended type is registered, you specify it in the Cayenne Model
as the Java type (that field/column is editable by you -- you aren't
restricted to the types in the pulldown).


On Thu, Oct 8, 2015 at 5:19 AM, Hugi Thordarson <h...@karlmenn.is> wrote:

> Thanks for the advice everyone. I think this is the correct way, writing
> cover methods won't really cut it in my case since I’m going to perform
> queries using the fields in question.
> The DB mixes different types for booleans in the database (some are
> strings, others are proper booleans) but It looks like I can check for the
> type of the field in the type adaptor before performing my operations, so I
> should be able to handle this correctly.
>
> Do you know how I register my own type adaptor for BooleanType?
>
> Cheers,
> - hugi
>
>
>
> > On 7. okt. 2015, at 19:08, John Huss <johnth...@gmail.com <mailto:
> johnth...@gmail.com>> wrote:
> >
> > Check out the code for org.apache.cayenne.access.types.BooleanType and
> it's
> > subclasses.  I think you need to create your own extended type to handle
> > it.  Not sure if you can have multiple different BooleanTypes in the same
> > runtime, but you could have one that detects and switches
> > behavior dynamically I guess.
> >
> > On Wed, Oct 7, 2015 at 12:19 PM Hugi Thordarson <h...@karlmenn.is
> <mailto:h...@karlmenn.is>> wrote:
> >
> >> Hi all.
> >>
> >> Oh the joys of working with legacy databases… :) I’m now using a
> database
> >> that sometimes stores boolean values as a char field with the value ’t’
> or
> >> ‘f’ (true or false). Can Cayenne help me map these fields to actual
> >> booleans in my entities so I don’t have to think about this in my logic?
> >>
> >> Cheers,
> >> - hugi
>
>

Reply via email to