Sorry,
It's been a mistake.
I didn't read the log correctly, and I also didn't check the DB correctly.
This problem doesn'r exist, and everything runs right.
Jorge
Mike Kienenberger wrote:
>Jorge Sopena <jsopen..idsa.es> wrote:
>
>
>>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.
>>
>>
>
>Have you checked the database to be sure only one object is inserted?
>
>Cayenne works with batch statements by default, meaning that one SQL
>PreparedStatement will include data for several operations. Maybe I'm
>reading the below incorrectly, but it looks like it did two insert
>operations (for primary key 3080 and 3081).
>
>
>
>
>>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?
>>
>>
>
>No.
>
>
>
>
>>Do I have to do a different commit for each object?
>>
>>
>
>No.
>
>
>
>
This archive was generated by hypermail 2.0.0 : Tue Mar 16 2004 - 12:28:33 EST