Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.2, 1.2.0
    • Fix Version/s: 1.0.3, 1.2.0
    • Component/s: jdbc
    • Labels:
      None

      Description

      If a schema name is provided on an entity-level Table annotation and a different schema name is used within a field-level TableGenerator, the mapping tool uses the the schema name provided in the field-level annotation to create the table, but the runtime generates SQL using the schema of the entity-level table annotation. The result is an exception when the runtime attempts to query the table.

      — For example:

      @Entity(name="SENTITY")
      @Table(name="SENTITY", schema="TBLSCHEMA")
      public class SingleEntity {
      @Id
      @TableGenerator(name = "SID_Gen", table = "ID_Gen", schema="TGSCHEMA",
      pkColumnName = "GEN_NAME", valueColumnName = "GEN_VAL",
      pkColumnValue = "ID2", initialValue = 20, allocationSize = 10)
      @GeneratedValue(strategy = GenerationType.TABLE, generator = "SID_Gen")
      private int id;

      ....
      }

      — Results in this SQL/exception:

      Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Table/View 'TBLSCHEMA.ID_GEN' does not exist.

      {SELECT GEN_VAL FROM TBLSCHEMA.ID_Gen WHERE GEN_NAME = ? FOR UPDATE WITH RR}

      [code=20000, state=42X05]

      The mapping tool creates the id generator table using the correct schema (TGSCHEMA).

      This issue is being opened as a subtask under OPENJPA-493. It was found while testing a back-port of the fix made in rev. 610427 to the 1.0.x stream.

      1. OPENJPA-648_1.0.x.patch
        13 kB
        Jeremy Bauer
      2. OPENJPA-648_1.2.0.patch
        13 kB
        Jeremy Bauer

        Activity

        Hide
        Jeremy Bauer added a comment -

        Attaching patch and jUnits for trunk/1.2.0. Please review and if no comments, commit for 1.0.x and 1.2.0.

        Show
        Jeremy Bauer added a comment - Attaching patch and jUnits for trunk/1.2.0. Please review and if no comments, commit for 1.0.x and 1.2.0.
        Hide
        Jeremy Bauer added a comment -

        Attaching patch and test cases for the 1.0.x release.

        Show
        Jeremy Bauer added a comment - Attaching patch and test cases for the 1.0.x release.

          People

          • Assignee:
            Jeremy Bauer
            Reporter:
            Jeremy Bauer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development