[OS-JIRA] Created: (CAY-498) ObjectId is TEMP after commit to database

From: JIRA (Hermann)
Date: Sat Apr 08 2006 - 16:06:49 EDT

  • Next message: Jason Dwyer: "Re: Does it make sense to move 1.2 branch to Apache?"

    ObjectId is TEMP after commit to database
    -----------------------------------------

             Key: CAY-498
             URL: http://objectstyle.org/jira/browse/CAY-498
         Project: Cayenne
            Type: Bug
      Components: Cayenne Core Library
        Versions: 1.2 [BETA]
     Environment: Mac OS X 10.4.6, Java 1.5.0, Cayenne 1.2B1, Hypersonic SQL 1.8.0.2, Eclipse 3.1.0
        Reporter: Hermann Röscheisen

    Committing a child data context to parent and the parent data context to database leaves the object id as TEMP.

    test02: OK
    DIRECT COMMIT: <ObjectId:Order, C_ORDER_ID=200>

    test03: OK
    CHILD COMMIT: <ObjectId:Order, C_ORDER_ID=201>

    test04: FAILURE
    CHILD-TO-PARENT, PARENT COMMIT: <ObjectId:Order, TEMP:0000020B0BEA0201>

    The source code:

            private void test02() {
                    DataContext dataContext = DataContext.createDataContext();
                    Order order = (Order) dataContext.createAndRegisterNewObject(Order.class);
                    order.setName("12345");
                    dataContext.commitChanges();
                    System.out.println("SIMPLE COMMIT: " + order.getObjectId());
            }
            
            private void test03() {
                    DataContext dataContext = DataContext.createDataContext();
                    DataContext childDataContext = dataContext.createChildDataContext();
                    Order order = (Order) childDataContext.createAndRegisterNewObject(Order.class);
                    order.setName("12345");
                    childDataContext.commitChanges();
                    System.out.println("CHILD COMMIT: " + order.getObjectId());
            }

            private void test04() {
                    DataContext dataContext = DataContext.createDataContext();
                    DataContext childDataContext = dataContext.createChildDataContext();
                    Order order = (Order) childDataContext.createAndRegisterNewObject(Order.class);
                    order.setName("12345");
                    childDataContext.commitChangesToParent();
                    dataContext.commitChanges();
                    System.out.println("CHILD-TO-PARENT, PARENT COMMIT: " + order.getObjectId());
            }

    -- 
    This message is automatically generated by JIRA.
    -
    If you think it was sent incorrectly contact one of the administrators:
       http://objectstyle.org/jira/secure/Administrators.jspa
    -
    For more information on JIRA, see:
       http://www.atlassian.com/software/jira
    



    This archive was generated by hypermail 2.0.0 : Sat Apr 08 2006 - 16:16:33 EDT