Re: Newbie Question?!

From: Eric Schneider (eri..entralparksoftware.com)
Date: Mon Apr 12 2004 - 10:50:44 EDT

  • Next message: Andrus Adamchik: "Re: Newbie Question?!"

    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(DataContext.java:614)
              at org.objectstyle.cayenne.access.util.SelectObserver.getResultsAsObjects(SelectObserver.java:190)
              at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java: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!

    ------------------------------------------------------------------------------
      Do you Yahoo!?
      Yahoo! Tax Center - File online by April 15th



    This archive was generated by hypermail 2.0.0 : Mon Apr 12 2004 - 10:50:26 EDT