Return-Path: Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: (qmail 1466 invoked from network); 5 Jan 2008 20:18:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jan 2008 20:18:16 -0000 Received: (qmail 28662 invoked by uid 500); 5 Jan 2008 20:18:05 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 28641 invoked by uid 500); 5 Jan 2008 20:18:05 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 28632 invoked by uid 99); 5 Jan 2008 20:18:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Jan 2008 12:18:05 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Jan 2008 20:18:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 149831A987C; Sat, 5 Jan 2008 12:17:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cayenne.apache.org From: aadamchik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080105201752.149831A987C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ org.apache.cayenne.jpa.itest.ch2.entity.Embeddable1 org.apache.cayenne.jpa.itest.ch2.entity.SerializableEmbeddable1 org.apache.cayenne.jpa.itest.ch2.entity.PropertyEmbeddable + org.apache.cayenne.jpa.itest.ch2.entity.SingleTableInheritanceSuper1 + org.apache.cayenne.jpa.itest.ch2.entity.SingleTableInheritanceSub1 + org.apache.cayenne.jpa.itest.ch2.entity.SingleTableInheritanceSub2 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));