Re: Represesntation of database NULL as something else than Java null pointer

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Thu Dec 14 2006 - 08:09:31 EST

  • Next message: Peter Karich: "Incorrect Insert-Statement Order After Deleting All Objects"

    On 12/14/06, Tore Halset <halse..vv.ntnu.no> wrote:
    > On Dec 14, 2006, at 9:11 , Øyvind Harboe wrote:
    >
    > > Could I implement my own "NeverNullString" datatype where I'm thinking
    > > that .toString() returns the either what Cayenne java.lang.String
    > > returns today or e.g. "" for the case where it represents a database
    > > null?
    >
    > Or perhaps map java.lang.CharSequence and create a NullString that
    > implements it. You could then create an ExtendedType (perhaps
    > subclass CharType) that does what you want.
    >
    > If your cayenne version if from before the fix of CAY-540 you may
    > have to register the type for each possible concreate class, just as
    > I did in the JTS-example.
    >
    > You may get into some problems with the wrong (default) ExtendedType
    > get picked before your own, but it should be fixable.

    OK.

    Q++: Is it a good idea to use ExtendedType to represent database null
    as something else than Java null pointer?

    -- 
    Øyvind Harboe
    http://www.zylin.com
    



    This archive was generated by hypermail 2.0.0 : Thu Dec 14 2006 - 08:11:00 EST