cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r609204 - in /cayenne/main/trunk/itests/jpa-chapter2/src: main/java/org/apache/cayenne/jpa/itest/ch2/entity/ main/resources/META-INF/ test/resources/
Date Sat, 05 Jan 2008 20:17:51 GMT
Author: aadamchik
Date: Sat Jan  5 12:17:50 2008
New Revision: 609204

URL: http://svn.apache.org/viewvc?rev=609204&view=rev
Log:
CAY-953 JPA: Single Table inheritance
(initial test case setup)

Added:
    cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub1.java
    cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub2.java
    cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSuper1.java
Modified:
    cayenne/main/trunk/itests/jpa-chapter2/src/main/resources/META-INF/persistence.xml
    cayenne/main/trunk/itests/jpa-chapter2/src/test/resources/schema-hsqldb.sql

Added: cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub1.java?rev=609204&view=auto
==============================================================================
--- cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub1.java
(added)
+++ cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub1.java
Sat Jan  5 12:17:50 2008
@@ -0,0 +1,41 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.jpa.itest.ch2.entity;
+
+import javax.persistence.Basic;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+@Entity
+@DiscriminatorValue(value = "B")
+public class SingleTableInheritanceSub1 extends SingleTableInheritanceSuper1 {
+
+    @Basic
+    protected String propertyB;
+
+    
+    public String getPropertyB() {
+        return propertyB;
+    }
+
+    
+    public void setPropertyB(String propertyB) {
+        this.propertyB = propertyB;
+    }
+}

Added: cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub2.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub2.java?rev=609204&view=auto
==============================================================================
--- cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub2.java
(added)
+++ cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSub2.java
Sat Jan  5 12:17:50 2008
@@ -0,0 +1,39 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.jpa.itest.ch2.entity;
+
+import javax.persistence.Basic;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+@Entity
+@DiscriminatorValue(value = "C")
+public class SingleTableInheritanceSub2 extends SingleTableInheritanceSuper1 {
+
+    @Basic
+    protected String propertyC;
+
+    public String getPropertyC() {
+        return propertyC;
+    }
+
+    public void setPropertyC(String propertyC) {
+        this.propertyC = propertyC;
+    }
+}

Added: cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSuper1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSuper1.java?rev=609204&view=auto
==============================================================================
--- cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSuper1.java
(added)
+++ cayenne/main/trunk/itests/jpa-chapter2/src/main/java/org/apache/cayenne/jpa/itest/ch2/entity/SingleTableInheritanceSuper1.java
Sat Jan  5 12:17:50 2008
@@ -0,0 +1,50 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.jpa.itest.ch2.entity;
+
+import javax.persistence.Basic;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="ST_INHERITANCE")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "objectType")
+@DiscriminatorValue(value = "A")
+public class SingleTableInheritanceSuper1 {
+
+    @Id
+    protected int id;
+
+    @Basic
+    protected String propertyA;
+
+    public String getPropertyA() {
+        return propertyA;
+    }
+
+    public void setPropertyA(String propertyA) {
+        this.propertyA = propertyA;
+    }
+}

Modified: cayenne/main/trunk/itests/jpa-chapter2/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/jpa-chapter2/src/main/resources/META-INF/persistence.xml?rev=609204&r1=609203&r2=609204&view=diff
==============================================================================
--- cayenne/main/trunk/itests/jpa-chapter2/src/main/resources/META-INF/persistence.xml (original)
+++ cayenne/main/trunk/itests/jpa-chapter2/src/main/resources/META-INF/persistence.xml Sat
Jan  5 12:17:50 2008
@@ -49,5 +49,8 @@
 		<class>org.apache.cayenne.jpa.itest.ch2.entity.Embeddable1</class>
 		<class>org.apache.cayenne.jpa.itest.ch2.entity.SerializableEmbeddable1</class>
 		<class>org.apache.cayenne.jpa.itest.ch2.entity.PropertyEmbeddable</class>
+		<class>org.apache.cayenne.jpa.itest.ch2.entity.SingleTableInheritanceSuper1</class>
+		<class>org.apache.cayenne.jpa.itest.ch2.entity.SingleTableInheritanceSub1</class>
+		<class>org.apache.cayenne.jpa.itest.ch2.entity.SingleTableInheritanceSub2</class>
 	</persistence-unit>
 </persistence>

Modified: cayenne/main/trunk/itests/jpa-chapter2/src/test/resources/schema-hsqldb.sql
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/jpa-chapter2/src/test/resources/schema-hsqldb.sql?rev=609204&r1=609203&r2=609204&view=diff
==============================================================================
--- cayenne/main/trunk/itests/jpa-chapter2/src/test/resources/schema-hsqldb.sql (original)
+++ cayenne/main/trunk/itests/jpa-chapter2/src/test/resources/schema-hsqldb.sql Sat Jan  5
12:17:50 2008
@@ -20,6 +20,7 @@
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('BidiOneToOneOwned', 1);
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('BidiOneToManyOwner', 1);
 insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('BidiOneToManyOwned', 1);
+insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ST_INHERITANCE', 1);
 
 create table FieldPersistenceEntity (id int not null, property1 VARCHAR(100), primary key(id));
 create table PropertyPersistenceEntity (id int not null, property1 VARCHAR(100), property2
BOOLEAN, primary key(id));
@@ -48,3 +49,4 @@
 create table BidiOneToManyOwned (id int not null, primary key(id));
 create table BidiOneToManyOwner (id int not null, owned_id int not null, primary key(id));
 alter table BidiOneToManyOwner add constraint cfk_owned_id1 FOREIGN KEY (owned_id) references
BidiOneToManyOwned (id);
+create table ST_INHERITANCE (id int not null, propertyA VARCHAR(100), propertyB VARCHAR(100),
propertyC VARCHAR(100), objectType VARCHAR(10), primary key(id));



Mime
View raw message