Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0RC2
-
None
Description
Preconditions:
1. A join table that have its own non-propagated PK that is "database generated"
2. A flattened relationship between two entities over the join table above
On insert, PKGenerator for the join table is (incorrectly) accessed:
INFO: LOCK TABLES AUTO_PK_SUPPORT WRITE
Mar 28, 2010 9:58:16 PM org.apache.cayenne.access.QueryLogger logQuery
INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = 'GENERATED_JOIN'
Mar 28, 2010 9:58:16 PM org.apache.cayenne.access.QueryLogger logQuery
INFO: UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID + 20 WHERE TABLE_NAME = 'GENERATED_JOIN' AND NEXT_ID = 200
Mar 28, 2010 9:58:16 PM org.apache.cayenne.access.QueryLogger logQuery
INFO: UNLOCK TABLES
Even though the store PK is (correctly) assigned based on the autoincrement value:
INFO: INSERT INTO GENERATED_JOIN (ID1, ID2) VALUES (?, ?)
Mar 28, 2010 9:58:16 PM org.apache.cayenne.access.QueryLogger logQueryParameters
INFO: [bind: 1->ID1:200, 2->ID2:200]
Should prevent uneeded PkGenerator call.