You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Hal Arnold <ha...@cj.com> on 2003/05/07 00:36:45 UTC
1:N update/inserts
Hi,
I'm following (as close as I can) the instructions with the example for =
1:N 'inserts' that uses Products and Articles.
I've got what looks to be an identical example using a =
TestBusinessObject (as the enclosing parent) and TestBizItem
which is the collection in the TestBusinessObject.
What it's (not) doing:
When I run the junit test that is supposed to create the parent, create =
two items, add the two items to the parent and
message the parent with the store, it creates all the objects (as =
evidenced by what's in the db), but doesn't put the=20
foreignKey for the parent into each of the kiddies.
I've got p6Spy hooked up and this is the sql call trace (minus the =
trace numbers):
SELECT MAX(ID) FROM TESTBIZITEM
SELECT A0.GRAB_SIZE,A0.MAX_KEY,A0.FIELDNAME,A0.TABLENAME FROM OJB_HL_SEQ =
A0 WHERE (A0.TABLENAME LIKE ? ) AND A0.FIELDNAME LIKE ? |SELECT =
A0.GRAB_SIZE,A0.MAX_KEY,A0.FIELDNAME,A0.TABLENAME FROM OJB_HL_SEQ A0 =
WHERE (A0.TABLENAME LIKE 'SEQ_TESTBIZITEM' ) AND A0.FIELDNAME LIKE =
'ID'=20
UPDATE OJB_HL_SEQ SET MAX_KEY=3D?, GRAB_SIZE=3D? WHERE TABLENAME =3D ? =
AND FIELDNAME =3D ? |UPDATE OJB_HL_SEQ SET MAX_KEY=3D'165', =
GRAB_SIZE=3D'5' WHERE TABLENAME =3D 'SEQ_TESTBIZITEM' AND FIELDNAME =3D =
'ID'=20
commit||
|SELECT MAX(ID) FROM TESTBUSINESSOBJECT
SELECT A0.GRAB_SIZE,A0.MAX_KEY,A0.FIELDNAME,A0.TABLENAME FROM OJB_HL_SEQ =
A0 WHERE (A0.TABLENAME LIKE ? ) AND A0.FIELDNAME LIKE ? |SELECT =
A0.GRAB_SIZE,A0.MAX_KEY,A0.FIELDNAME,A0.TABLENAME FROM OJB_HL_SEQ A0 =
WHERE (A0.TABLENAME LIKE 'SEQ_TESTBUSINESSOBJECT' ) AND A0.FIELDNAME =
LIKE 'ID'=20
UPDATE OJB_HL_SEQ SET MAX_KEY=3D?, GRAB_SIZE=3D? WHERE TABLENAME =3D ? =
AND FIELDNAME =3D ? |UPDATE OJB_HL_SEQ SET MAX_KEY=3D'267', =
GRAB_SIZE=3D'5' WHERE TABLENAME =3D 'SEQ_TESTBUSINESSOBJECT' AND =
FIELDNAME =3D 'ID'=20
commit||
SELECT NAME,ID FROM TESTBUSINESSOBJECT WHERE ID =3D ? |SELECT NAME,ID =
FROM TESTBUSINESSOBJECT WHERE ID =3D '263'=20
INSERT INTO TESTBUSINESSOBJECT (ID,NAME) VALUES ( ?, ? ) |INSERT INTO =
TESTBUSINESSOBJECT (ID,NAME) VALUES ( '263', 'testParent' )=20
SELECT TEST_BUSINESS_OBJECT_ID,NAME,ID FROM TESTBIZITEM WHERE ID =3D ? =
|SELECT TEST_BUSINESS_OBJECT_ID,NAME,ID FROM TESTBIZITEM WHERE ID =3D =
'161'=20
INSERT INTO TESTBIZITEM (ID,NAME,TEST_BUSINESS_OBJECT_ID) VALUES ( ?, ?, =
? ) |INSERT INTO TESTBIZITEM (ID,NAME,TEST_BUSINESS_OBJECT_ID) VALUES ( =
'161', 'test1', '' )=20
SELECT TEST_BUSINESS_OBJECT_ID,NAME,ID FROM TESTBIZITEM WHERE ID =3D ? =
|SELECT TEST_BUSINESS_OBJECT_ID,NAME,ID FROM TESTBIZITEM WHERE ID =3D =
'162'=20
INSERT INTO TESTBIZITEM (ID,NAME,TEST_BUSINESS_OBJECT_ID) VALUES ( ?, ?, =
? ) |INSERT INTO TESTBIZITEM (ID,NAME,TEST_BUSINESS_OBJECT_ID) VALUES ( =
'162', 'test2', '' )=20
commit||
Alas, when it does the inserts into testBizItem, the last field is empty =
and should have the value '263'. I know I'm being addled here, but I =
can't see what the error might be...=20
Any help would greatly be appreciated,
Hal Arnold