Index: C:/Java/castor-2/cpactf/src/test/ddl/mysql.sql
===================================================================
--- C:/Java/castor-2/cpactf/src/test/ddl/mysql.sql (revision 6885)
+++ C:/Java/castor-2/cpactf/src/test/ddl/mysql.sql (working copy)
@@ -1275,9 +1275,8 @@
INSERT INTO tc9x_poly_depend_object VALUES(1, 1, 'This is a description');
-# TC129
--- TC20x - self-referential relations
+-- TC20x
drop table if exists tc200_self_relation_folder;
create table tc200_self_relation_folder (
@@ -1298,3 +1297,18 @@
id int not null,
parent_id int null
);
+
+drop table if exists tc202_foreign_key_first_entity_1;
+create table tc202_foreign_key_first_entity_1 (
+ id int NOT NULL,
+ number int NULL
+);
+
+drop table if exists tc202_foreign_key_first_entity_n;
+create table tc202_foreign_key_first_entity_n (
+ id int NOT NULL,
+ entity int NOT NULL,
+ number int NULL
+);
+
+insert into tc202_foreign_key_first_entity_1 VALUES (1, 1);
Index: C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/ForeignKeyFirstEntity1.java
===================================================================
--- C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/ForeignKeyFirstEntity1.java (revision 0)
+++ C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/ForeignKeyFirstEntity1.java (revision 0)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2007 Ralf Joachim
+ *
+ * Licensed 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 ctf.jdo.tc20x;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class ForeignKeyFirstEntity1 {
+ private int _id;
+ private int _number;
+ private Collection _entities = new ArrayList(0);
+
+ public int getId() { return _id; }
+
+ public void setId(final int id) { _id = id; }
+
+ public int getNumber() { return _number; }
+
+ public void setNumber(final int number) { _number = number; }
+
+ public Collection getEntities() {
+ if (_entities == null) { _entities = new ArrayList(0); }
+ return _entities;
+ }
+
+ public void setEntities(final Collection entities) {
+ _entities = entities;
+ }
+}
Index: C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/ForeignKeyFirstEntityN.java
===================================================================
--- C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/ForeignKeyFirstEntityN.java (revision 0)
+++ C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/ForeignKeyFirstEntityN.java (revision 0)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2007 Ralf Joachim
+ *
+ * Licensed 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 ctf.jdo.tc20x;
+
+public class ForeignKeyFirstEntityN {
+ private int _id;
+ private ForeignKeyFirstEntity1 _entity;
+
+ public int getId() { return _id; }
+
+ public void setId(final int id) { _id = id; }
+
+ public ForeignKeyFirstEntity1 getEntity() { return _entity; }
+
+ public void setEntity(final ForeignKeyFirstEntity1 entity) { _entity = entity; }
+}
Index: C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/TestForeignKeyFirst.java
===================================================================
--- C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/TestForeignKeyFirst.java (revision 0)
+++ C:/Java/castor-2/cpactf/src/test/java/ctf/jdo/tc20x/TestForeignKeyFirst.java (revision 0)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2007 Ralf Joachim
+ *
+ * Licensed 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 ctf.jdo.tc20x;
+
+import harness.CastorTestCase;
+import harness.TestHarness;
+
+import jdo.JDOCategory;
+
+import org.exolab.castor.jdo.Database;
+import org.exolab.castor.jdo.PersistenceException;
+
+public final class TestForeignKeyFirst extends CastorTestCase {
+ private JDOCategory _category;
+
+ public TestForeignKeyFirst(final TestHarness category) {
+ super(category, "TC202", "ForeignKeyFirst tests");
+ _category = (JDOCategory) category;
+ }
+
+ public void runTest() throws PersistenceException {
+ testLoad();
+ }
+
+ public void testLoad() throws PersistenceException {
+ Database db = _category.getDatabase();
+
+ db.begin();
+
+ Object entity = db.load(ForeignKeyFirstEntity1.class, new Integer(1));
+ assertNotNull(entity);
+
+ db.commit();
+
+ if (db != null) {
+ if (db.isActive()) { db.rollback(); }
+
+ db.close();
+ db = null;
+ }
+ }
+}
Index: C:/Java/castor-2/cpactf/src/test/resources/ctf/jdo/tc20x/mapping.xml
===================================================================
--- C:/Java/castor-2/cpactf/src/test/resources/ctf/jdo/tc20x/mapping.xml (revision 6885)
+++ C:/Java/castor-2/cpactf/src/test/resources/ctf/jdo/tc20x/mapping.xml (working copy)
@@ -57,5 +57,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: C:/Java/castor-2/cpactf/src/test/resources/tests.xml
===================================================================
--- C:/Java/castor-2/cpactf/src/test/resources/tests.xml (revision 6885)
+++ C:/Java/castor-2/cpactf/src/test/resources/tests.xml (working copy)
@@ -94,7 +94,7 @@
-
+
@@ -199,7 +199,7 @@
-
+
@@ -297,7 +297,7 @@
-
+
@@ -397,7 +397,7 @@
-
+
@@ -498,7 +498,7 @@
-
+
@@ -597,7 +597,7 @@
-
+
@@ -695,7 +695,7 @@
-
+
@@ -793,7 +793,7 @@
-
+
@@ -895,7 +895,7 @@
-
+
@@ -998,7 +998,7 @@
-
+
@@ -1095,7 +1095,7 @@
-
+