Re: Newbie Question?!

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Apr 12 2004 - 11:17:52 EDT

  • Next message: Mike Kienenberger: "Oracle 9i empty-string-to-null writeProperty hack"

    Looking at Cayenne code, the error message describes exactly what
    happens: "BOOKS" DbEntity doesn't have a single attribute marked as PK.

    > tick marking the necessary column in the Attributes table and
    > generating schema

    Looks like you are doing the right thing here, just make sure that all
    latest Cayenne *.xml and *.map.xml files are copied to the right
    deployment location. Looks like you may have the old version of
    *.map.xml somewhere.

    Andrus

    On Apr 12, 2004, at 10:50 AM, Eric Schneider wrote:
    > Karthik,
    >  
    > I'm not sure how the DB2 adaptor handles its auto pk generation
    > stuff.  I'm guessing it uses an auto_pk table (similar to MySQL).
    >  
    > Try this.  Make sure that your PK attributes defined in your DBEntity
    > are NOT defined in your ObjEntity.  If pk attributes are included in
    > the ObjEntity, Cayenne assumes that you will provide the pk value. 
    >  
    > Hope this helps,
    > Eric
    > ----- Original Message -----
    > From: Karthik Krishnan
    > To: cayenne-use..bjectstyle.org
    > Sent: Monday, April 12, 2004 10:05 AM
    > Subject: Newbie Question?!
    >
    > Hello!
    >        I currently want to use Cayenne in my project and am in the
    > process of exploring Cayenne.But then I have got stuck up now with one
    > exception. I am using DB2 as the database. The thing is the tables I
    > am doing the project on,doesnt have a primary key.As a result, I tried
    > to use the Auto PK generation feature in Cayenne Modeller(tick marking
    > the necessary column in the Attributes table and generating schema).
    > But whatever I do, I get the following exception 
    > org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1M4 March 5
    > 2004] Can't create ObjectId for 'Books'. Reason: DbEntity 'BOOKS' has
    > no Primary Key defined.
    >         at
    > org.objectstyle.cayenne.access.DataContext.objectsFromDataRows(DataCont
    > ext.java:614)
    >         at
    > org.objectstyle.cayenne.access.util.SelectObserver.getResultsAsObjects(
    > SelectObserver.java:190)
    >         at
    > org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.jav
    > a:1200)
    >         at BookCheck.getBook(Bookcheck.java:38)
    >         at BookCheck.main(Bookcheck.java:28)
    > Exception in thread "main"
    >  
    >  
    > I searched for possible solutions in the mailing lists but I was not
    > able to find any solution..Any pointers would be helpful.
    >  
    > Thanks in Advance!
    >



    This archive was generated by hypermail 2.0.0 : Mon Apr 12 2004 - 11:17:57 EDT