Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1409

Pkgenerator is accessed needlessly for join tables with own database generated PK

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0RC2
    • 3.0RC3
    • Core Library
    • 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.

      Attachments

        Activity

          People

            andrus Andrus Adamchik
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: