RE: errors with derby and hsqldb (i need to switch from mysql to an embedded db)

From: Scott Anderson (sanderso..irvana.com)
Date: Fri Sep 19 2008 - 12:56:00 EDT

  • Next message: Chad Smith: "Re: Cayenne 2.0.4 are reverse relationships required"

    > Than I suppose that the problem is hsqldb, which return "ID" as column
    > name, also if it was created as "id", am i right?

    I've never used HSQLDB, but I know Derby likes to think of its table and
    field names as all upper-case. Derby does not, however, appear to be
    case sensitive from my experience.

    -----Original Message-----
    From: Steave [mailto:stefanonafet..mail.com]
    Sent: Friday, September 19, 2008 9:42 AM
    To: use..ayenne.apache.org
    Subject: Re: errors with derby and hsqldb (i need to switch from mysql
    to an embedded db)

    YES IT WORKS!!!!

    I've modified both the SQLTemplate string and dbAttribute in Cayenne
    Modeler
    (i've put every table and column name in uppercase, just to be sure (it
    also
    looks more sql compliant :-) )) and now it works!!!
    I also had to change a "db:id" in "db:ID" somewhere in an ordering
    clausule,
    but it's ok :-)

    Than I suppose that the problem is hsqldb, which return "ID" as column
    name,
    also if it was created as "id", am i right?

    Scott, Andrey, thank you a lot!!!!
    Also thanks to all the guys who spend time to develop Cayenne and
    support
    stupid guys with stupid questions like mine :-)

    Thank you!!

    ps, sorry for "Steave" name that appair when I send a mails with gmail,
    I
    don't know why it happens and how to change this behivour.
    My name is Stefano Parravicini, sorry if I forgot to inroduce me :-)

    Thank you again

    2008/9/19 Andrey Razumovsky <razumovsky.andre..mail.com>

    > Oh, i meant you should probably rename DbAttribute 'id' to 'ID' in
    > Cayenne Modeler
    >
    > 2008/9/19, Andrey Razumovsky <razumovsky.andre..mail.com>:
    > > Hi Steave,
    > >
    > > ID is obviously not null following snapshot output
    (values={TITLE=asd,
    > > ID=200}), but ID is uppercase here, so when you use
    dataRow.get("id")
    > > it will return null. I think you must use uppercased "id", e.g.
    > >
    > >
    > > SQLTemplate template = new SQLTemplate(CayCanvass.class, "select *
    > >
    > > from Canvass c where c.ID = (select MAX(c.ID) from Canvass c)");
    > >
    > > Still, I do not know enough about Derby and HSQL to tell for sure
    why
    > > it happened.
    > >
    > > Hope that helps,
    > > Andrey
    > >
    > > 2008/9/18, Steave <stefanonafet..mail.com>:
    > >
    > > > ps, no rows in Canvass have id column = null ,
    > > > and the table reflects the ddl written in my last mail
    > > >
    > > >
    > > > 2008/9/18 Steave <stefanonafet..mail.com>
    > > >
    > > >
    > > > > For schema, do you intend the db schema?
    > > > > If it is,
    > > > >
    > > > > well, this is the CREATE statement generated by modeler for
    hsqldb:
    > > > >
    > > > > CREATE CACHED TABLE Canvass (id BIGINT NOT NULL, title
    VARCHAR(150)
    > NULL,
    > > > > PRIMARY KEY (id)
    > > > > ;
    > > > >
    > > > > In the modeler, both "Pk" and "Mandarory" are checked for id
    > column.
    > > > >
    > > > >
    > > > > 2008/9/18 Scott Anderson <sanderso..irvana.com>
    > > > >
    > > > > > Null value for 'id'.
    > > > >>
    > > > >> Is id set to NULL in the schema, but MANDATORY in the Cayenne
    map?
    > I'm
    > > > >> not sure if I'm interpreting the error correctly, but it
    sounds
    > like
    > > > >> Cayenne sees a NULL where it doesn't expect one.
    > > > >>
    > > > >
    > > > >
    > > >
    > >
    >



    This archive was generated by hypermail 2.0.0 : Fri Sep 19 2008 - 12:57:41 EDT