Creating several equal objects in the same DataContext

From: Jorge Sopena (jsopen..idsa.es)
Date: Tue Mar 16 2004 - 11:29:34 EST

  • Next message: Mike Kienenberger: "Re: Creating several equal objects in the same DataContext"

    Hi,

    I'm having problems when I create several instances of the same Object.
    I mean, I do several :
        Request r = (Request)ctxt.createAndRegisterNewObject("Request");

    The DataContext is the same in each case.
    But when I do the commit only one Request is inserted.
    I've seen in the log there is one INSERT query and several updates on
    this row.
    The log is the following:

    INFO QueryLogger: LOCK TABLES AUTO_PK_SUPPORT WRITE
    INFO QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME
    = 'request'
    INFO QueryLogger: UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID + 20
    WHERE TABLE_NAME = 'request' AND NEXT_ID = 3080
    INFO QueryLogger: UNLOCK TABLES
    INFO QueryLogger: --- will run 1 query.
    INFO QueryLogger: INSERT INTO request (Customer_CustomerId, EndDate,
    Invoice_idInvoice, MobileObject_MobileObjectId, RequestId,
    RequestType_idRequestType, StartDate, StatusType) VALUES (?, ?, ?, ?, ?,
    ?, ?, ?)
    INFO QueryLogger: [bind: 0, NULL, NULL, 320, 3080, 110, '2004-03-16
    16:16:07.984', 'INIT']
    INFO QueryLogger: === updated 1 row.
    INFO QueryLogger: [bind: 0, '2004-03-16 16:16:11.531', NULL, 320, 3081,
    110, '2004-03-16 16:16:07.968', 'COMPLETED']
    INFO QueryLogger: === updated 1 row.
    INFO QueryLogger: +++ transaction committed.

    In fact, if I ask for the newObjects() in the DataContext before doing
    the commit, the two objects are returned.

    Do I have to do anything special in these case?
    Do I have to do a different commit for each object?

    Thanks
    Jorge



    This archive was generated by hypermail 2.0.0 : Tue Mar 16 2004 - 11:22:13 EST