Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2022

Reversemappingtooltask with oracle is failing like in OPENJPA-1940 previous bug

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0, 2.1.1, 2.2.0
    • Fix Version/s: 2.4.0
    • Component/s: tooling
    • Labels:
      None
    • Environment:
      Woking on a windows pc with a oracle 10g express database, eclipse helios, using oracle 11.2.0.2 driver.

      Description

      When running either of the versions of the reversemappingtool as reported in the 1940 bug as fixed, i get the same error as in 2.1.0 :

      [reversemappingtool] 2363 openjpa INFO [main] openjpa.Tool - ReverseMappingTool : generating classes.
      [reversemappingtool] 2365 openjpa INFO [main] openjpa.MetaData - Table "RMTOOLS."AppUsers"" could not be reverse mapped. This means that the table does not have a primary key (primary keys are required to establish unique identifiers for all persistent objects) and does not match a known pattern for a table used for cross-reference or value collections.
      [reversemappingtool] 2366 openjpa INFO [main] openjpa.MetaData - Table "RMTOOLS."CredentialTypes"" could not be reverse mapped. This means that the table does not have a primary key (primary keys are required to establish unique identifiers for all persistent objects) and does not match a known pattern for a table used for cross-reference or value collections.
      [reversemappingtool] 2366 openjpa INFO [main] openjpa.MetaData - Table "RMTOOLS."Credentials"" could not be reverse mapped. This means that the table does not have a primary key (primary keys are required to establish unique identifiers for all persistent objects) and does not match a known pattern for a table used for cross-reference or value collections.

      this happens for all my tables. Is it possible this bug was reintroduced?

      thanks

        Issue Links

          Activity

          Hide
          mikedd Michael Dick added a comment -

          Could you run the OpenJPAVersion command and post the results here. Also if you could post the DDL for one of the tables that can't be reverse mapped that might help us to narrow down the problem.

          Show
          mikedd Michael Dick added a comment - Could you run the OpenJPAVersion command and post the results here. Also if you could post the DDL for one of the tables that can't be reverse mapped that might help us to narrow down the problem.
          Hide
          semora sebastien morissette added a comment -

          Hi, my database is at home so i will have to get back to you for the DDL,

          however, here is the output of the openjpaversion...

          [java] OpenJPA 2.1.1-SNAPSHOT
          [java] version id: openjpa-2.1.1-SNAPSHOT-r422266:1134440
          [java] Apache svn revision: 422266:1134440
          [java] os.name: Windows 7
          [java] os.version: 6.1
          [java] os.arch: x86
          [java] java.version: 1.6.0
          [java] java.vendor: IBM Corporation
          [java] java.class.path:
          [java] C:\Data\workspace\openJPADBMapping
          [java] C:\Data\workspace\openJPADBMapping\lib\ojdbc6.jar
          [java] C:\Data\workspace\openJPADBMapping\lib\openjpa-all-2.1.1-SNAPSHOT.jar
          [java] user.dir: C:\Data\workspace\openJPADBMapping\src

          Show
          semora sebastien morissette added a comment - Hi, my database is at home so i will have to get back to you for the DDL, however, here is the output of the openjpaversion... [java] OpenJPA 2.1.1-SNAPSHOT [java] version id: openjpa-2.1.1-SNAPSHOT-r422266:1134440 [java] Apache svn revision: 422266:1134440 [java] os.name: Windows 7 [java] os.version: 6.1 [java] os.arch: x86 [java] java.version: 1.6.0 [java] java.vendor: IBM Corporation [java] java.class.path: [java] C:\Data\workspace\openJPADBMapping [java] C:\Data\workspace\openJPADBMapping\lib\ojdbc6.jar [java] C:\Data\workspace\openJPADBMapping\lib\openjpa-all-2.1.1-SNAPSHOT.jar [java] user.dir: C:\Data\workspace\openJPADBMapping\src
          Hide
          semora sebastien morissette added a comment -

          here is the ddl for 3 of my tables

          ALTER TABLE RMTOOLS."AppUsers"
          DROP PRIMARY KEY CASCADE;
          DROP TABLE RMTOOLS."AppUsers" CASCADE CONSTRAINTS;

          CREATE TABLE RMTOOLS."AppUsers"
          (
          "AppUser" NUMBER(12) NOT NULL,
          "Name" VARCHAR2(100 BYTE) NOT NULL,
          "Email" VARCHAR2(100 BYTE) NOT NULL,
          "Creation_Date" DATE NOT NULL,
          "pager" VARCHAR2(100 BYTE),
          "LDAPuserId" VARCHAR2(100 BYTE) NOT NULL,
          "Active" VARCHAR2(5 BYTE) NOT NULL
          )
          TABLESPACE USERS
          PCTUSED 0
          PCTFREE 10
          INITRANS 1
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          BUFFER_POOL DEFAULT
          )
          LOGGING
          NOCOMPRESS
          NOCACHE
          NOPARALLEL
          MONITORING;

          CREATE UNIQUE INDEX RMTOOLS."Key8" ON RMTOOLS."AppUsers"
          ("AppUser")
          LOGGING
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          BUFFER_POOL DEFAULT
          )
          NOPARALLEL;

          ALTER TABLE RMTOOLS."AppUsers" ADD (
          CONSTRAINT "Key8"
          PRIMARY KEY
          ("AppUser")
          USING INDEX
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          ));

          ALTER TABLE RMTOOLS."Credentials"
          DROP PRIMARY KEY CASCADE;
          DROP TABLE RMTOOLS."Credentials" CASCADE CONSTRAINTS;

          CREATE TABLE RMTOOLS."Credentials"
          (
          CREDENTIAL NUMBER(12),
          USERNAME VARCHAR2(50 BYTE) CONSTRAINT SYS_C004201 NOT NULL,
          PASSWORD VARCHAR2(50 BYTE),
          KEY VARCHAR2(200 BYTE),
          LABEL VARCHAR2(25 BYTE),
          "CredentialType" NUMBER(12) NOT NULL
          )
          TABLESPACE USERS
          PCTUSED 0
          PCTFREE 10
          INITRANS 1
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          BUFFER_POOL DEFAULT
          )
          LOGGING
          NOCOMPRESS
          NOCACHE
          NOPARALLEL
          MONITORING;

          CREATE UNIQUE INDEX RMTOOLS.CREDENTIALS_PK ON RMTOOLS."Credentials"
          (CREDENTIAL)
          LOGGING
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          BUFFER_POOL DEFAULT
          )
          NOPARALLEL;

          CREATE UNIQUE INDEX RMTOOLS.SYS_C004204 ON RMTOOLS."Credentials"
          (LABEL)
          LOGGING
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          BUFFER_POOL DEFAULT
          )
          NOPARALLEL;

          ALTER TABLE RMTOOLS."Credentials" ADD (
          CONSTRAINT CREDENTIALS_PK
          PRIMARY KEY
          (CREDENTIAL)
          USING INDEX
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          ),
          CONSTRAINT SYS_C004204
          UNIQUE (LABEL)
          USING INDEX
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          ));

          ALTER TABLE RMTOOLS."Credentials" ADD (
          CONSTRAINT "Relationship12"
          FOREIGN KEY ("CredentialType")
          REFERENCES RMTOOLS."CredentialTypes" ("CredentialType"));

          ALTER TABLE RMTOOLS."CredentialTypes"
          DROP PRIMARY KEY CASCADE;
          DROP TABLE RMTOOLS."CredentialTypes" CASCADE CONSTRAINTS;

          CREATE TABLE RMTOOLS."CredentialTypes"
          (
          "CredentialType" NUMBER(12) NOT NULL,
          "Label" VARCHAR2(100 BYTE),
          "Type" VARCHAR2(100 BYTE) NOT NULL
          )
          TABLESPACE USERS
          PCTUSED 0
          PCTFREE 10
          INITRANS 1
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          BUFFER_POOL DEFAULT
          )
          LOGGING
          NOCOMPRESS
          NOCACHE
          NOPARALLEL
          MONITORING;

          CREATE UNIQUE INDEX RMTOOLS."Key2" ON RMTOOLS."CredentialTypes"
          ("CredentialType")
          LOGGING
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          BUFFER_POOL DEFAULT
          )
          NOPARALLEL;

          ALTER TABLE RMTOOLS."CredentialTypes" ADD (
          CONSTRAINT "Key2"
          PRIMARY KEY
          ("CredentialType")
          USING INDEX
          TABLESPACE USERS
          PCTFREE 10
          INITRANS 2
          MAXTRANS 255
          STORAGE (
          INITIAL 64K
          MINEXTENTS 1
          MAXEXTENTS UNLIMITED
          PCTINCREASE 0
          ));

          Show
          semora sebastien morissette added a comment - here is the ddl for 3 of my tables ALTER TABLE RMTOOLS."AppUsers" DROP PRIMARY KEY CASCADE; DROP TABLE RMTOOLS."AppUsers" CASCADE CONSTRAINTS; CREATE TABLE RMTOOLS."AppUsers" ( "AppUser" NUMBER(12) NOT NULL, "Name" VARCHAR2(100 BYTE) NOT NULL, "Email" VARCHAR2(100 BYTE) NOT NULL, "Creation_Date" DATE NOT NULL, "pager" VARCHAR2(100 BYTE), "LDAPuserId" VARCHAR2(100 BYTE) NOT NULL, "Active" VARCHAR2(5 BYTE) NOT NULL ) TABLESPACE USERS PCTUSED 0 PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING; CREATE UNIQUE INDEX RMTOOLS."Key8" ON RMTOOLS."AppUsers" ("AppUser") LOGGING TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT ) NOPARALLEL; ALTER TABLE RMTOOLS."AppUsers" ADD ( CONSTRAINT "Key8" PRIMARY KEY ("AppUser") USING INDEX TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 )); ALTER TABLE RMTOOLS."Credentials" DROP PRIMARY KEY CASCADE; DROP TABLE RMTOOLS."Credentials" CASCADE CONSTRAINTS; CREATE TABLE RMTOOLS."Credentials" ( CREDENTIAL NUMBER(12), USERNAME VARCHAR2(50 BYTE) CONSTRAINT SYS_C004201 NOT NULL, PASSWORD VARCHAR2(50 BYTE), KEY VARCHAR2(200 BYTE), LABEL VARCHAR2(25 BYTE), "CredentialType" NUMBER(12) NOT NULL ) TABLESPACE USERS PCTUSED 0 PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING; CREATE UNIQUE INDEX RMTOOLS.CREDENTIALS_PK ON RMTOOLS."Credentials" (CREDENTIAL) LOGGING TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT ) NOPARALLEL; CREATE UNIQUE INDEX RMTOOLS.SYS_C004204 ON RMTOOLS."Credentials" (LABEL) LOGGING TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT ) NOPARALLEL; ALTER TABLE RMTOOLS."Credentials" ADD ( CONSTRAINT CREDENTIALS_PK PRIMARY KEY (CREDENTIAL) USING INDEX TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 ), CONSTRAINT SYS_C004204 UNIQUE (LABEL) USING INDEX TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 )); ALTER TABLE RMTOOLS."Credentials" ADD ( CONSTRAINT "Relationship12" FOREIGN KEY ("CredentialType") REFERENCES RMTOOLS."CredentialTypes" ("CredentialType")); ALTER TABLE RMTOOLS."CredentialTypes" DROP PRIMARY KEY CASCADE; DROP TABLE RMTOOLS."CredentialTypes" CASCADE CONSTRAINTS; CREATE TABLE RMTOOLS."CredentialTypes" ( "CredentialType" NUMBER(12) NOT NULL, "Label" VARCHAR2(100 BYTE), "Type" VARCHAR2(100 BYTE) NOT NULL ) TABLESPACE USERS PCTUSED 0 PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING; CREATE UNIQUE INDEX RMTOOLS."Key2" ON RMTOOLS."CredentialTypes" ("CredentialType") LOGGING TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 BUFFER_POOL DEFAULT ) NOPARALLEL; ALTER TABLE RMTOOLS."CredentialTypes" ADD ( CONSTRAINT "Key2" PRIMARY KEY ("CredentialType") USING INDEX TABLESPACE USERS PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0 ));
          Hide
          mikedd Michael Dick added a comment -

          Do you specify the schemas and table names when you invoke the reverse mapping tool?

          There's definitely a problem here - I'm not sure it's the same problem as 1940, or if something has changed upstream that prevents the code I changed in 1940 from executing though.

          Show
          mikedd Michael Dick added a comment - Do you specify the schemas and table names when you invoke the reverse mapping tool? There's definitely a problem here - I'm not sure it's the same problem as 1940, or if something has changed upstream that prevents the code I changed in 1940 from executing though.
          Hide
          semora sebastien morissette added a comment -

          I use an ant task and i added the schema name in my persistence.xml

          here is my build.xml :

          <?xml version="1.0" encoding="UTF-8"?>
          <project name="rmtools" default="reverse-map-schema">
          <path id="classpath"
          description="The classpath to use for compiling and running">
          <pathelement path="../"/>
          <fileset dir="../">
          <include name="lib/openjpa-all-2.1.1-SNAPSHOT.jar"/>
          <include name="lib/ojdbc6.jar"/>
          </fileset>
          </path>
          <target name="reverse-map-schema" description="Generate java files from the database schema">

          <java fork="true" failonerror="yes" classname="org.apache.openjpa.conf.OpenJPAVersion" classpathref="classpath"/>
          <!-- now run the tool to generate java files from the db schema -->
          <taskdef name="reversemappingtool" classpathref="classpath" classname="org.apache.openjpa.jdbc.ant.ReverseMappingToolTask"/>
          <reversemappingtool package="com.rmtools.util.dao" directory="../src" innerIdentityClasses="true">
          <codeformat tabSpaces="4" spaceBeforeParen="false" braceOnSameLine="true"/>
          </reversemappingtool>

          </target>
          </project>

          here is my persistence.xml :

          <?xml version="1.0" encoding="UTF-8"?>
          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          version="1.0">
          <persistence-unit name="openjpa">
          <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
          <class>com.rmtools.dao.beans.AppUsers</class>

          <properties>
          <property name="openjpa.ConnectionURL" value="jdbc:oracle:thin:@192.168.1.102:1521:xe"/>
          <property name="openjpa.ConnectionDriverName" value="oracle.jdbc.OracleDriver"/>
          <property name="openjpa.ConnectionUserName" value="xxxx"/>
          <property name="openjpa.ConnectionPassword" value="xxxx"/>
          <property name="openjpa.jdbc.Schema" value="rmtools"/>
          <property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=TRACE,org.apache.openjpa.jdbc.Schema=TRACE"/>
          </properties>
          </persistence-unit>
          </persistence>

          Show
          semora sebastien morissette added a comment - I use an ant task and i added the schema name in my persistence.xml here is my build.xml : <?xml version="1.0" encoding="UTF-8"?> <project name="rmtools" default="reverse-map-schema"> <path id="classpath" description="The classpath to use for compiling and running"> <pathelement path="../"/> <fileset dir="../"> <include name="lib/openjpa-all-2.1.1-SNAPSHOT.jar"/> <include name="lib/ojdbc6.jar"/> </fileset> </path> <target name="reverse-map-schema" description="Generate java files from the database schema"> <java fork="true" failonerror="yes" classname="org.apache.openjpa.conf.OpenJPAVersion" classpathref="classpath"/> <!-- now run the tool to generate java files from the db schema --> <taskdef name="reversemappingtool" classpathref="classpath" classname="org.apache.openjpa.jdbc.ant.ReverseMappingToolTask"/> <reversemappingtool package="com.rmtools.util.dao" directory="../src" innerIdentityClasses="true"> <codeformat tabSpaces="4" spaceBeforeParen="false" braceOnSameLine="true"/> </reversemappingtool> </target> </project> here is my persistence.xml : <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"> <persistence-unit name="openjpa"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <class>com.rmtools.dao.beans.AppUsers</class> <properties> <property name="openjpa.ConnectionURL" value="jdbc:oracle:thin:@192.168.1.102:1521:xe"/> <property name="openjpa.ConnectionDriverName" value="oracle.jdbc.OracleDriver"/> <property name="openjpa.ConnectionUserName" value="xxxx"/> <property name="openjpa.ConnectionPassword" value="xxxx"/> <property name="openjpa.jdbc.Schema" value="rmtools"/> <property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=TRACE,org.apache.openjpa.jdbc.Schema=TRACE"/> </properties> </persistence-unit> </persistence>
          Hide
          sujua Suju Abraham added a comment -

          I get the same error on 2.0.1. Is there a target version where this will be fixed?

          Show
          sujua Suju Abraham added a comment - I get the same error on 2.0.1. Is there a target version where this will be fixed?
          Hide
          mikedd Michael Dick added a comment -

          I didn't get a chance to look at this today, and I don't have access to Oracle from home. For a target version it really depends on what the fix is. At a bare minimum it'll be fixed in a 2.2.0 nightly build.

          Show
          mikedd Michael Dick added a comment - I didn't get a chance to look at this today, and I don't have access to Oracle from home. For a target version it really depends on what the fix is. At a bare minimum it'll be fixed in a 2.2.0 nightly build.
          Hide
          allee8285 Albert Lee added a comment -

          Move fix version to 2.3.0 in preparation for 2.2.0 release.

          Show
          allee8285 Albert Lee added a comment - Move fix version to 2.3.0 in preparation for 2.2.0 release.
          Hide
          jzwolak Jason Zwolak added a comment -

          I'm also having this same issue in 2.2.2, 2.2.0, 2.1.1, and 2.3.0-snapshot (Oct 24th, 2013).

          Here's the DDL and the OpenJPA generated schema.xml for one table (this schema.xml was generated with the 2.3.0 snapshot, but I'm pretty sure it looks identical for 2.2.2, 2.2.0, and 2.1.1).

          SCHEMA:

                  <table name="MODELS">
                      <column name="MODEL_ID" type="decimal" type-name="NUMBER" not-null="true" size="22"/>
                      <column name="MODEL_DESCRIPTION" type="varchar" type-name="VARCHAR2" not-null="true" size="240"/>
                      <column name="PERSON_ID" type="decimal" type-name="NUMBER" not-null="true" size="22"/>
                      <column name="VERSION_NUM" type="decimal" type-name="NUMBER" size="22"/>
                      <column name="VERSION_DESC" type="varchar" type-name="VARCHAR2" size="80"/>
                      <column name="VERSION_DATE" type="timestamp" type-name="DATE" default="sysdate" size="7"/>
                      <column name="LOCK_FLAG" type="varchar" type-name="VARCHAR2" size="1"/>
                      <column name="BASE_MODEL_ID" type="decimal" type-name="NUMBER" size="22"/>
                      <column name="PRIVATE_FLAG" type="varchar" type-name="VARCHAR2" size="1"/>
                      <column name="SECURITY_LEVEL" type="decimal" type-name="NUMBER" size="22"/>
                      <column name="LAST_MODIFIED" type="timestamp" type-name="TIMESTAMP(6)" default="sysdate" size="11" decimal-digits="6"/>
                      <fk name="MODL_MODL_FK" delete-action="restrict" to-table="PROCESSDB_DEV.MODELS" column="BASE_MODEL_ID"/>
                      <fk name="MODL_PERS_FK" delete-action="restrict" to-table="PROCESSDB_DEV.PERSONS" column="PERSON_ID"/>
                      <index name="MODL_PERS_FK_I" column="PERSON_ID"/>
                      <index name="MODL_PK" unique="true" column="MODEL_ID"/>
                  </table>
          

          DDL:

            CREATE TABLE "PROCESSDB_DEV"."MODELS" 
             (	"MODEL_ID" NUMBER NOT NULL ENABLE, 
          	"MODEL_DESCRIPTION" VARCHAR2(240 BYTE) NOT NULL ENABLE, 
          	"PERSON_ID" NUMBER NOT NULL ENABLE, 
          	"VERSION_NUM" NUMBER, 
          	"VERSION_DESC" VARCHAR2(80 BYTE), 
          	"VERSION_DATE" DATE DEFAULT sysdate, 
          	"LOCK_FLAG" VARCHAR2(1 BYTE), 
          	"BASE_MODEL_ID" NUMBER, 
          	"PRIVATE_FLAG" VARCHAR2(1 BYTE), 
          	"SECURITY_LEVEL" NUMBER, 
          	"LAST_MODIFIED" TIMESTAMP (6) DEFAULT sysdate, 
          	 CONSTRAINT "MODL_PK" PRIMARY KEY ("MODEL_ID")
            USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
            STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
            PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
            TABLESPACE "USERS"  ENABLE, 
          	 CONSTRAINT "MODL_MODL_FK" FOREIGN KEY ("BASE_MODEL_ID")
          	  REFERENCES "PROCESSDB_DEV"."MODELS" ("MODEL_ID") ENABLE NOVALIDATE, 
          	 CONSTRAINT "MODL_PERS_FK" FOREIGN KEY ("PERSON_ID")
          	  REFERENCES "PROCESSDB_DEV"."PERSONS" ("PERSON_ID") ENABLE NOVALIDATE
             ) SEGMENT CREATION IMMEDIATE 
            PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
            STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
            PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
            TABLESPACE "USERS" ;
          
            CREATE INDEX "PROCESSDB_DEV"."MODL_PERS_FK_I" ON "PROCESSDB_DEV"."MODELS" ("PERSON_ID") 
            PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
            STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
            PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
            TABLESPACE "USERS" ;
          
          Show
          jzwolak Jason Zwolak added a comment - I'm also having this same issue in 2.2.2, 2.2.0, 2.1.1, and 2.3.0-snapshot (Oct 24th, 2013). Here's the DDL and the OpenJPA generated schema.xml for one table (this schema.xml was generated with the 2.3.0 snapshot, but I'm pretty sure it looks identical for 2.2.2, 2.2.0, and 2.1.1). SCHEMA: <table name= "MODELS" > <column name= "MODEL_ID" type= "decimal" type-name= "NUMBER" not- null = " true " size= "22" /> <column name= "MODEL_DESCRIPTION" type= "varchar" type-name= "VARCHAR2" not- null = " true " size= "240" /> <column name= "PERSON_ID" type= "decimal" type-name= "NUMBER" not- null = " true " size= "22" /> <column name= "VERSION_NUM" type= "decimal" type-name= "NUMBER" size= "22" /> <column name= "VERSION_DESC" type= "varchar" type-name= "VARCHAR2" size= "80" /> <column name= "VERSION_DATE" type= "timestamp" type-name= "DATE" default = "sysdate" size= "7" /> <column name= "LOCK_FLAG" type= "varchar" type-name= "VARCHAR2" size= "1" /> <column name= "BASE_MODEL_ID" type= "decimal" type-name= "NUMBER" size= "22" /> <column name= "PRIVATE_FLAG" type= "varchar" type-name= "VARCHAR2" size= "1" /> <column name= "SECURITY_LEVEL" type= "decimal" type-name= "NUMBER" size= "22" /> <column name= "LAST_MODIFIED" type= "timestamp" type-name= "TIMESTAMP(6)" default = "sysdate" size= "11" decimal-digits= "6" /> <fk name= "MODL_MODL_FK" delete-action= "restrict" to-table= "PROCESSDB_DEV.MODELS" column= "BASE_MODEL_ID" /> <fk name= "MODL_PERS_FK" delete-action= "restrict" to-table= "PROCESSDB_DEV.PERSONS" column= "PERSON_ID" /> <index name= "MODL_PERS_FK_I" column= "PERSON_ID" /> <index name= "MODL_PK" unique= " true " column= "MODEL_ID" /> </table> DDL: CREATE TABLE "PROCESSDB_DEV" . "MODELS" ( "MODEL_ID" NUMBER NOT NULL ENABLE, "MODEL_DESCRIPTION" VARCHAR2(240 BYTE) NOT NULL ENABLE, "PERSON_ID" NUMBER NOT NULL ENABLE, "VERSION_NUM" NUMBER, "VERSION_DESC" VARCHAR2(80 BYTE), "VERSION_DATE" DATE DEFAULT sysdate, "LOCK_FLAG" VARCHAR2(1 BYTE), "BASE_MODEL_ID" NUMBER, "PRIVATE_FLAG" VARCHAR2(1 BYTE), "SECURITY_LEVEL" NUMBER, "LAST_MODIFIED" TIMESTAMP (6) DEFAULT sysdate, CONSTRAINT "MODL_PK" PRIMARY KEY ( "MODEL_ID" ) USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE, CONSTRAINT "MODL_MODL_FK" FOREIGN KEY ( "BASE_MODEL_ID" ) REFERENCES "PROCESSDB_DEV" . "MODELS" ( "MODEL_ID" ) ENABLE NOVALIDATE, CONSTRAINT "MODL_PERS_FK" FOREIGN KEY ( "PERSON_ID" ) REFERENCES "PROCESSDB_DEV" . "PERSONS" ( "PERSON_ID" ) ENABLE NOVALIDATE ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ; CREATE INDEX "PROCESSDB_DEV" . "MODL_PERS_FK_I" ON "PROCESSDB_DEV" . "MODELS" ( "PERSON_ID" ) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ;
          Hide
          jzwolak Jason Zwolak added a comment -

          This patch fixed the problem for me. Based on the comments in this issue, I think my problem is the same as the original issue reported, but I cannot test for the original reporter.

          The problem is on line 695 of org.apache.openjpa.jdbc.schema.SchemaGenerator

          which starts the primary key generation and looks like
          schemaName = DBIdentifier.trimToNull(schemaName);

          But should look more like the code for indices (line 760) and foreign keys:
          schemaName = DBIdentifier.trimToNull(idxs[i].getSchemaIdentifier());

          Show
          jzwolak Jason Zwolak added a comment - This patch fixed the problem for me. Based on the comments in this issue, I think my problem is the same as the original issue reported, but I cannot test for the original reporter. The problem is on line 695 of org.apache.openjpa.jdbc.schema.SchemaGenerator which starts the primary key generation and looks like schemaName = DBIdentifier.trimToNull(schemaName); But should look more like the code for indices (line 760) and foreign keys: schemaName = DBIdentifier.trimToNull(idxs [i] .getSchemaIdentifier());
          Hide
          ayl2 Aron Lurie added a comment -
          Show
          ayl2 Aron Lurie added a comment - The attached patch also worked for me. Why hasn't it been applied to trunk? https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1569106 from Rick Curtis in branch 'openjpa/trunk'
          [ https://svn.apache.org/r1569106 ]

          OPENJPA-2022 : Minor change to SchemaGenerator. Patch contributed by Jason Zwolak.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1569106 from Rick Curtis in branch 'openjpa/trunk' [ https://svn.apache.org/r1569106 ] OPENJPA-2022 : Minor change to SchemaGenerator. Patch contributed by Jason Zwolak.
          Hide
          curtisr7 Rick Curtis added a comment -

          Committed revision 1569106 to trunk. Thanks for the patch Jason.

          Show
          curtisr7 Rick Curtis added a comment - Committed revision 1569106 to trunk. Thanks for the patch Jason.

            People

            • Assignee:
              curtisr7 Rick Curtis
              Reporter:
              semora sebastien morissette
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development