Author: aadamchik
Date: Wed Aug 9 18:33:01 2006
New Revision: 430206
URL: http://svn.apache.org/viewvc?rev=430206&view=rev
Log:
another test JPA integration test - checking entity persistence types
Added:
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyPersistenceEntity.java
Modified:
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/FieldPersistenceEntity.java
incubator/cayenne/sandbox/itest-unit1/src/main/resources/META-INF/persistence.xml
incubator/cayenne/sandbox/itest-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java
incubator/cayenne/sandbox/itest-unit1/src/test/resources/schema-hsqldb.sql
Modified:
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/FieldPersistenceEntity.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/FieldPersistenceEntity.java?rev=430206&r1=430205&r2=430206&view=diff
==============================================================================
---
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/FieldPersistenceEntity.java
(original)
+++
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/FieldPersistenceEntity.java
Wed Aug 9 18:33:01 2006
@@ -29,7 +29,6 @@
@Id
protected int id;
- @Id
protected int property1;
public int getProperty1() {
Added:
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyPersistenceEntity.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyPersistenceEntity.java?rev=430206&view=auto
==============================================================================
---
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyPersistenceEntity.java
(added)
+++
incubator/cayenne/sandbox/itest-unit1/src/main/java/org/apache/cayenne/jpa/itest1/entity/PropertyPersistenceEntity.java
Wed Aug 9 18:33:01 2006
@@ -0,0 +1,47 @@
+/*****************************************************************
+ * 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.itest1.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
[EMAIL PROTECTED]
+public class PropertyPersistenceEntity {
+
+ protected int idx;
+
+ protected int property1x;
+
+ @Id
+ public int getId() {
+ return idx;
+ }
+
+ public void setId(int id) {
+ this.idx = id;
+ }
+
+ public int getProperty1() {
+ return property1x;
+ }
+
+ public void setProperty1(int property1) {
+ this.property1x = property1;
+ }
+}
Modified:
incubator/cayenne/sandbox/itest-unit1/src/main/resources/META-INF/persistence.xml
URL:
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/itest-unit1/src/main/resources/META-INF/persistence.xml?rev=430206&r1=430205&r2=430206&view=diff
==============================================================================
---
incubator/cayenne/sandbox/itest-unit1/src/main/resources/META-INF/persistence.xml
(original)
+++
incubator/cayenne/sandbox/itest-unit1/src/main/resources/META-INF/persistence.xml
Wed Aug 9 18:33:01 2006
@@ -22,5 +22,6 @@
<persistence-unit name="ItestUnit1">
<description>Integration test peristence unit #1.</description>
<class>org.apache.cayenne.jpa.itest1.entity.FieldPersistenceEntity</class>
+
<class>org.apache.cayenne.jpa.itest1.entity.PropertyPersistenceEntity</class>
</persistence-unit>
</persistence>
Modified:
incubator/cayenne/sandbox/itest-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/itest-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java?rev=430206&r1=430205&r2=430206&view=diff
==============================================================================
---
incubator/cayenne/sandbox/itest-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java
(original)
+++
incubator/cayenne/sandbox/itest-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java
Wed Aug 9 18:33:01 2006
@@ -24,6 +24,7 @@
import org.apache.cayenne.jpa.itest.Unit1TestHelper;
import org.apache.cayenne.jpa.itest1.entity.FieldPersistenceEntity;
+import org.apache.cayenne.jpa.itest1.entity.PropertyPersistenceEntity;
public class EntityClassTest extends TestCase {
@@ -36,8 +37,18 @@
em.flush();
}
+ public void testPropertyBasedPersistence() {
+
+ EntityManager em = Unit1TestHelper.getInstance().createEntityManager();
+
+ PropertyPersistenceEntity o1 = new PropertyPersistenceEntity();
+ em.persist(o1);
+ em.flush();
+ }
+
public static void main(String[] args) {
new EntityClassTest().testFieldBasedPersistence();
+ new EntityClassTest().testPropertyBasedPersistence();
}
}
Modified:
incubator/cayenne/sandbox/itest-unit1/src/test/resources/schema-hsqldb.sql
URL:
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/itest-unit1/src/test/resources/schema-hsqldb.sql?rev=430206&r1=430205&r2=430206&view=diff
==============================================================================
--- incubator/cayenne/sandbox/itest-unit1/src/test/resources/schema-hsqldb.sql
(original)
+++ incubator/cayenne/sandbox/itest-unit1/src/test/resources/schema-hsqldb.sql
Wed Aug 9 18:33:01 2006
@@ -1,4 +1,6 @@
create table AUTO_PK_SUPPORT (TABLE_NAME CHAR(100) NOT NULL, NEXT_ID INTEGER
NOT NULL, PRIMARY KEY(TABLE_NAME));
insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES
('FieldPersistenceEntity', 1);
+insert into AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES
('PropertyPersistenceEntity', 1);
-create table FieldPersistenceEntity (id int not null, property1 varchar(100),
primary key(id));
\ No newline at end of file
+create table FieldPersistenceEntity (id int not null, property1 int, primary
key(id));
+create table PropertyPersistenceEntity (id int not null, property1 int,
primary key(id));
\ No newline at end of file