openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anand213 <akumar...@bankofamerica.com>
Subject Unique constraint annotations not generated by Reverse Mapping tool
Date Thu, 06 Dec 2012 15:00:25 GMT
Hi, 
I am trying to reverse map beans by directly connecting to H2 DB. Below is
the DB schema to reverse. It has couple of unique keys and a non-unique key.
These are read by the tool but no annotations generated for the same: 

CREATE SCHEMA TEST; 

CREATE TABLE TEST.EMPLOYEE_FOR_CACHE ( 
ID INT PRIMARY KEY, 
FNAME VARCHAR2(50), 
LNAME VARCHAR2(50), 
PROJECT VARCHAR2(10), 
DEPT VARCHAR2(50), 
LOCATION VARCHAR2(50) 
); 

-- Indexes: 
CREATE INDEX ON TEST.EMPLOYEE_FOR_CACHE(LNAME); 
CREATE UNIQUE INDEX ON TEST.EMPLOYEE_FOR_CACHE(FNAME, LNAME, LOCATION); 
CREATE UNIQUE INDEX ON TEST.EMPLOYEE_FOR_CACHE(DEPT, PROJECT); 


Below is the generated bean: 
@Entity 
@Table( name="EMPLOYEE_FOR_CACHE") 
public class EmployeeForCache { 
        @Basic 
        @Column(length=50) 
        private String dept; 

        @Basic 
        @Column(length=50) 
        private String fname; 

        @Id 
        private int id; 

        @Basic 
        @Column(length=50) 
        private String lname; 

        @Basic 
        @Column(length=50) 
        private String location; 

        @Basic 
        @Column(length=10) 
        private String project; 


        public EmployeeForCache() { 
        } 

        public EmployeeForCache(int id) { 
                this.id = id; 
        } 

        public String getDept() { 
                return dept; 
        } 

        public void setDept(String dept) { 
                this.dept = dept; 
        } 

        public String getFname() { 
                return fname; 
        } 

        public void setFname(String fname) { 
                this.fname = fname; 
        } 

        public int getId() { 
                return id; 
        } 

        public void setId(int id) { 
                this.id = id; 
        } 

        public String getLname() { 
                return lname; 
        } 

        public void setLname(String lname) { 
                this.lname = lname; 
        } 

        public String getLocation() { 
                return location; 
        } 

        public void setLocation(String location) { 
                this.location = location; 
        } 

        public String getProject() { 
                return project; 
        } 

        public void setProject(String project) { 
                this.project = project; 
        } 
} 



Below are the logs: 

94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Found
existing index "INDEX_14" on table "TEST.EMPLOYEE_FOR_CACHE (FNAME)". 
94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Found
existing index "INDEX_14" on table "TEST.EMPLOYEE_FOR_CACHE (LNAME)". 
94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Found
existing index "INDEX_14" on table "TEST.EMPLOYEE_FOR_CACHE (LOCATION)". 
94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Found
existing index "INDEX_14C" on table "TEST.EMPLOYEE_FOR_CACHE (DEPT)". 
94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Found
existing index "INDEX_14C" on table "TEST.EMPLOYEE_FOR_CACHE (PROJECT)". 
94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Found
existing index "PRIMARY_KEY_1" on table "TEST.EMPLOYEE_FOR_CACHE (ID)". 
94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Found
existing index "INDEX_1" on table "TEST.EMPLOYEE_FOR_CACHE (LNAME)". 
94  cut-jpa-bean-generator  TRACE  [main] openjpa.jdbc.Schema - Reading
foreign keys for schema name "TEST", table name "TEST.EMPLOYEE_FOR_CACHE". 
109  cut-jpa-bean-generator  INFO   [main] openjpa.Tool - ReverseMappingTool
: generating classes. 
107259  cut-jpa-bean-generator  INFO   [main] openjpa.Tool - Generating
annotations. 
110368  cut-jpa-bean-generator  INFO   [main] openjpa.Tool - Writing
generated class source code. 



I am using below reverse properties: 
-pkg, com.bofa.cut.jpa.entity.bean, -directory, ./scr/test/java, -log,
'DefaultLevel=WARN, Tool=INFO, SQL=TRACE,Schema=TRACE', -metadata, none,
-useGenericCollections, true, -annotations, true, -connectionURL, ..... 

OPen JPA version: 2.2.0

Thanks and Regards, 
AKumar



--
View this message in context: http://openjpa.208410.n2.nabble.com/Unique-constraint-annotations-not-generated-by-Reverse-Mapping-tool-tp7582055.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message