cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r905960 - in /cayenne/main/branches/STABLE-3.0: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inherita...
Date Wed, 03 Feb 2010 09:53:45 GMT
Author: aadamchik
Date: Wed Feb  3 09:53:40 2010
New Revision: 905960

URL: http://svn.apache.org/viewvc?rev=905960&view=rev
Log:
CAY-1379 Error resolving fault, no matching row exists in the database

patch by Victor Antonovich

Added:
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Group.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/GroupProperties.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/InheritanceFlat.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Role.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/User.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/UserProperties.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Group.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_GroupProperties.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_InheritanceFlat.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Role.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_User.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_UserProperties.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_1379Test.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-flat.map.xml
Modified:
    cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataRowUtils.java
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne.xml
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml

Modified: cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=905960&r1=905959&r2=905960&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt Wed Feb
 3 09:53:40 2010
@@ -14,6 +14,7 @@
 
 Bug Fixes Since 3.0RC2:
 
+CAY-1379 Error resolving fault, no matching row exists in the database
 CAY-1382 org.apache.cayenne.reflect.EnumConverter not handling null values for ExtendedEnumerations
 CAY-1383 unneeded target in modeler attributes inspection 
 

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataRowUtils.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataRowUtils.java?rev=905960&r1=905959&r2=905960&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataRowUtils.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataRowUtils.java
Wed Feb  3 09:53:40 2010
@@ -28,7 +28,6 @@
 import org.apache.cayenne.map.DbJoin;
 import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.ObjAttribute;
-import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.reflect.ArcProperty;
 import org.apache.cayenne.reflect.AttributeProperty;
@@ -194,14 +193,12 @@
                                     property.writeProperty(object, null, null);
                                 }
                                 else {
-                                    // if inheritance is involved, we can't use
-                                    // 'localObject'
+                                    // we can't use 'localObject' if relationship is
+                                    // optional or inheritance is involved
                                     // .. must turn to fault instead
-                                    ObjEntity targetEntity = (ObjEntity) relationship
-                                            .getTargetEntity();
-                                    if (context
-                                            .getEntityResolver()
-                                            .lookupInheritanceTree(targetEntity) != null)
{
+                                    if (!relationship
+                                            .isSourceDefiningTargetPrecenseAndType(context
+                                                    .getEntityResolver())) {
                                         property.invalidate(object);
                                     }
                                     else {

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Group.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Group.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Group.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Group.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,7 @@
+package org.apache.cayenne.testdo.inheritance_flat;
+
+import org.apache.cayenne.testdo.inheritance_flat.auto._Group;
+
+public class Group extends _Group {
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/GroupProperties.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/GroupProperties.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/GroupProperties.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/GroupProperties.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,7 @@
+package org.apache.cayenne.testdo.inheritance_flat;
+
+import org.apache.cayenne.testdo.inheritance_flat.auto._GroupProperties;
+
+public class GroupProperties extends _GroupProperties {
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/InheritanceFlat.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/InheritanceFlat.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/InheritanceFlat.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/InheritanceFlat.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,18 @@
+package org.apache.cayenne.testdo.inheritance_flat;
+
+import org.apache.cayenne.testdo.inheritance_flat.auto._InheritanceFlat;
+
+public class InheritanceFlat extends _InheritanceFlat {
+
+    private static InheritanceFlat instance;
+
+    private InheritanceFlat() {}
+
+    public static InheritanceFlat getInstance() {
+        if(instance == null) {
+            instance = new InheritanceFlat();
+        }
+
+        return instance;
+    }
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Role.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Role.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Role.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/Role.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,17 @@
+package org.apache.cayenne.testdo.inheritance_flat;
+
+import org.apache.cayenne.testdo.inheritance_flat.auto._Role;
+
+public class Role extends _Role {
+
+    @Override
+    protected void onPostPersist() {
+        //TODO: implement onPostPersist
+    }
+
+    @Override
+    protected void onPostUpdate() {
+        //TODO: implement onPostUpdate
+    }
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/User.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/User.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/User.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/User.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,7 @@
+package org.apache.cayenne.testdo.inheritance_flat;
+
+import org.apache.cayenne.testdo.inheritance_flat.auto._User;
+
+public class User extends _User {
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/UserProperties.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/UserProperties.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/UserProperties.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/UserProperties.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,7 @@
+package org.apache.cayenne.testdo.inheritance_flat;
+
+import org.apache.cayenne.testdo.inheritance_flat.auto._UserProperties;
+
+public class UserProperties extends _UserProperties {
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Group.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Group.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Group.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Group.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,43 @@
+package org.apache.cayenne.testdo.inheritance_flat.auto;
+
+import java.util.List;
+
+import org.apache.cayenne.testdo.inheritance_flat.GroupProperties;
+import org.apache.cayenne.testdo.inheritance_flat.Role;
+import org.apache.cayenne.testdo.inheritance_flat.User;
+
+/**
+ * Class _Group was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _Group extends User {
+
+    public static final String GROUP_MEMBERS_PROPERTY = "groupMembers";
+    public static final String GROUP_PROPERTIES_PROPERTY = "groupProperties";
+
+    public static final String ID_PK_COLUMN = "id";
+
+    public void addToGroupMembers(Role obj) {
+        addToManyTarget("groupMembers", obj, true);
+    }
+    public void removeFromGroupMembers(Role obj) {
+        removeToManyTarget("groupMembers", obj, true);
+    }
+    @SuppressWarnings("unchecked")
+    public List<Role> getGroupMembers() {
+        return (List<Role>)readProperty("groupMembers");
+    }
+
+
+    public void setGroupProperties(GroupProperties groupProperties) {
+        setToOneTarget("groupProperties", groupProperties, true);
+    }
+
+    public GroupProperties getGroupProperties() {
+        return (GroupProperties)readProperty("groupProperties");
+    }
+
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_GroupProperties.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_GroupProperties.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_GroupProperties.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_GroupProperties.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,43 @@
+package org.apache.cayenne.testdo.inheritance_flat.auto;
+
+import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.testdo.inheritance_flat.Group;
+
+/**
+ * Class _GroupProperties was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _GroupProperties extends CayenneDataObject {
+
+    public static final String DESCRIPTION_PROPERTY = "description";
+    public static final String ID_PROPERTY = "id";
+    public static final String GROUP_PROPERTY = "group";
+
+    public static final String ID_PK_COLUMN = "id";
+
+    public void setDescription(String description) {
+        writeProperty("description", description);
+    }
+    public String getDescription() {
+        return (String)readProperty("description");
+    }
+
+    public void setId(Long id) {
+        writeProperty("id", id);
+    }
+    public Long getId() {
+        return (Long)readProperty("id");
+    }
+
+    public void setGroup(Group group) {
+        setToOneTarget("group", group, true);
+    }
+
+    public Group getGroup() {
+        return (Group)readProperty("group");
+    }
+
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_InheritanceFlat.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_InheritanceFlat.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_InheritanceFlat.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_InheritanceFlat.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,12 @@
+package org.apache.cayenne.testdo.inheritance_flat.auto;
+
+
+
+/**
+ * This class was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public class _InheritanceFlat {
+}
\ No newline at end of file

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Role.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Role.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Role.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_Role.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,62 @@
+package org.apache.cayenne.testdo.inheritance_flat.auto;
+
+import java.util.List;
+
+import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.testdo.inheritance_flat.Group;
+
+/**
+ * Class _Role was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _Role extends CayenneDataObject {
+
+    public static final String ID_PROPERTY = "id";
+    public static final String NAME_PROPERTY = "name";
+    public static final String TYPE_PROPERTY = "type";
+    public static final String ROLE_GROUPS_PROPERTY = "roleGroups";
+
+    public static final String ID_PK_COLUMN = "id";
+
+    public void setId(long id) {
+        writeProperty("id", id);
+    }
+    public long getId() {
+        Object value = readProperty("id");
+        return (value != null) ? (Long) value : 0;
+    }
+
+    public void setName(String name) {
+        writeProperty("name", name);
+    }
+    public String getName() {
+        return (String)readProperty("name");
+    }
+
+    public void setType(int type) {
+        writeProperty("type", type);
+    }
+    public int getType() {
+        Object value = readProperty("type");
+        return (value != null) ? (Integer) value : 0;
+    }
+
+    public void addToRoleGroups(Group obj) {
+        addToManyTarget("roleGroups", obj, true);
+    }
+    public void removeFromRoleGroups(Group obj) {
+        removeToManyTarget("roleGroups", obj, true);
+    }
+    @SuppressWarnings("unchecked")
+    public List<Group> getRoleGroups() {
+        return (List<Group>)readProperty("roleGroups");
+    }
+
+
+    protected abstract void onPostPersist();
+
+    protected abstract void onPostUpdate();
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_User.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_User.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_User.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_User.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,27 @@
+package org.apache.cayenne.testdo.inheritance_flat.auto;
+
+import org.apache.cayenne.testdo.inheritance_flat.Role;
+import org.apache.cayenne.testdo.inheritance_flat.UserProperties;
+
+/**
+ * Class _User was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _User extends Role {
+
+    public static final String USER_PROPERTIES_PROPERTY = "userProperties";
+
+    public static final String ID_PK_COLUMN = "id";
+
+    public void setUserProperties(UserProperties userProperties) {
+        setToOneTarget("userProperties", userProperties, true);
+    }
+
+    public UserProperties getUserProperties() {
+        return (UserProperties)readProperty("userProperties");
+    }
+
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_UserProperties.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_UserProperties.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_UserProperties.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/inheritance_flat/auto/_UserProperties.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,43 @@
+package org.apache.cayenne.testdo.inheritance_flat.auto;
+
+import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.testdo.inheritance_flat.User;
+
+/**
+ * Class _UserProperties was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _UserProperties extends CayenneDataObject {
+
+    public static final String ID_PROPERTY = "id";
+    public static final String NICKNAME_PROPERTY = "nickname";
+    public static final String USER_PROPERTY = "user";
+
+    public static final String ID_PK_COLUMN = "id";
+
+    public void setId(Long id) {
+        writeProperty("id", id);
+    }
+    public Long getId() {
+        return (Long)readProperty("id");
+    }
+
+    public void setNickname(String nickname) {
+        writeProperty("nickname", nickname);
+    }
+    public String getNickname() {
+        return (String)readProperty("nickname");
+    }
+
+    public void setUser(User user) {
+        setToOneTarget("user", user, true);
+    }
+
+    public User getUser() {
+        return (User)readProperty("user");
+    }
+
+
+}

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_1379Test.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_1379Test.java?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_1379Test.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_1379Test.java
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,57 @@
+package org.apache.cayenne.unit.jira;
+
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.exp.ExpressionFactory;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.testdo.inheritance_flat.Group;
+import org.apache.cayenne.testdo.inheritance_flat.Role;
+import org.apache.cayenne.testdo.inheritance_flat.User;
+import org.apache.cayenne.unit.AccessStack;
+import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.CayenneResources;
+
+public class CAY_1379Test extends CayenneCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteTestData();
+    }
+
+    @Override
+    protected AccessStack buildAccessStack() {
+        return CayenneResources.getResources().getAccessStack("InheritanceFlatStack");
+    }
+
+    public void testGroupActions() throws Exception {
+
+        DataContext context = createDataContext();
+
+        User user = context.newObject(User.class);
+        user.setName("test_user");
+
+        Group group1 = context.newObject(Group.class);
+        group1.setName("test_group1");
+
+        Group group2 = context.newObject(Group.class);
+        group2.setName("test_group2");
+
+        group1.addToGroupMembers(user);
+        group2.addToGroupMembers(group1);
+
+        group2.getObjectContext().commitChanges();
+
+        // Per CAY-1379 removing user and then refetching resulted in a FFE downstream
+        group1.removeFromGroupMembers(user);
+        Expression exp = ExpressionFactory.matchExp(Role.ROLE_GROUPS_PROPERTY, group2);
+        SelectQuery query = new SelectQuery(Group.class, exp);
+        context.performQuery(query);
+        context.commitChanges();
+
+        context.deleteObject(group1);
+        context.deleteObject(group2);
+        context.deleteObject(user);
+        context.commitChanges();
+    }
+}

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne.xml
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne.xml?rev=905960&r1=905959&r2=905960&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne.xml
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne.xml
Wed Feb  3 09:53:40 2010
@@ -4,6 +4,7 @@
 	<map name="embeddable" location="embeddable.map.xml"/>
 	<map name="generic" location="generic.map.xml"/>
 	<map name="inheritance" location="inheritance.map.xml"/>
+	<map name="inheritance-flat" location="inheritance-flat.map.xml"/>
 	<map name="locking" location="locking.map.xml"/>
 	<map name="map-db1" location="map-db1.map.xml"/>
 	<map name="map-db2" location="map-db2.map.xml"/>

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-flat.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-flat.map.xml?rev=905960&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-flat.map.xml
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/inheritance-flat.map.xml
Wed Feb  3 09:53:40 2010
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap http://cayenne.apache.org/schema/3.0/modelMap.xsd"
+  project-version="3.0.0.1">
+	<property name="defaultPackage" value="org.apache.cayenne.testdo.inheritance_flat"/>
+	<db-entity name="GroupMembers">
+		<db-attribute name="group_id" type="BIGINT" isMandatory="true"/>
+		<db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="role_id" type="BIGINT" isMandatory="true"/>
+	</db-entity>
+	<db-entity name="GroupProperties">
+		<db-attribute name="description" type="VARCHAR" length="100"/>
+		<db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
+	</db-entity>
+	<db-entity name="Roles">
+		<db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="name" type="VARCHAR" isMandatory="true" length="32"/>
+		<db-attribute name="type" type="SMALLINT" isMandatory="true"/>
+	</db-entity>
+	<db-entity name="UserProperties">
+		<db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="nickname" type="VARCHAR" length="32"/>
+	</db-entity>
+	<obj-entity name="Group" superEntityName="User" className="org.apache.cayenne.testdo.inheritance_flat.Group">
+		<qualifier><![CDATA[type = 2]]></qualifier>
+	</obj-entity>
+	<obj-entity name="GroupProperties" className="org.apache.cayenne.testdo.inheritance_flat.GroupProperties"
dbEntityName="GroupProperties">
+		<obj-attribute name="description" type="java.lang.String" db-attribute-path="description"/>
+		<obj-attribute name="id" type="java.lang.Long" db-attribute-path="id"/>
+	</obj-entity>
+	<obj-entity name="Role" className="org.apache.cayenne.testdo.inheritance_flat.Role" dbEntityName="Roles">
+		<qualifier><![CDATA[type = 0]]></qualifier>
+		<obj-attribute name="id" type="long" db-attribute-path="id"/>
+		<obj-attribute name="name" type="java.lang.String" lock="true" db-attribute-path="name"/>
+		<obj-attribute name="type" type="int" db-attribute-path="type"/>
+		<post-persist method-name="onPostPersist"/>
+		<post-update method-name="onPostUpdate"/>
+	</obj-entity>
+	<obj-entity name="User" superEntityName="Role" className="org.apache.cayenne.testdo.inheritance_flat.User">
+		<qualifier><![CDATA[type = 1]]></qualifier>
+		<attribute-override name="id" db-attribute-path="id"/>
+		<attribute-override name="name" db-attribute-path="name"/>
+		<attribute-override name="type" db-attribute-path="type"/>
+	</obj-entity>
+	<obj-entity name="UserProperties" className="org.apache.cayenne.testdo.inheritance_flat.UserProperties"
dbEntityName="UserProperties">
+		<obj-attribute name="id" type="java.lang.Long" db-attribute-path="id"/>
+		<obj-attribute name="nickname" type="java.lang.String" db-attribute-path="nickname"/>
+	</obj-entity>
+	<db-relationship name="group" source="GroupMembers" target="Roles" toMany="false">
+		<db-attribute-pair source="group_id" target="id"/>
+	</db-relationship>
+	<db-relationship name="role" source="GroupMembers" target="Roles" toMany="false">
+		<db-attribute-pair source="role_id" target="id"/>
+	</db-relationship>
+	<db-relationship name="group" source="GroupProperties" target="Roles" toMany="false">
+		<db-attribute-pair source="id" target="id"/>
+	</db-relationship>
+	<db-relationship name="group_members" source="Roles" target="GroupMembers" toMany="true">
+		<db-attribute-pair source="id" target="group_id"/>
+	</db-relationship>
+	<db-relationship name="group_properties" source="Roles" target="GroupProperties" toDependentPK="true"
toMany="false">
+		<db-attribute-pair source="id" target="id"/>
+	</db-relationship>
+	<db-relationship name="role_groups" source="Roles" target="GroupMembers" toMany="true">
+		<db-attribute-pair source="id" target="role_id"/>
+	</db-relationship>
+	<db-relationship name="user_properties" source="Roles" target="UserProperties" toDependentPK="true"
toMany="false">
+		<db-attribute-pair source="id" target="id"/>
+	</db-relationship>
+	<db-relationship name="user" source="UserProperties" target="Roles" toMany="false">
+		<db-attribute-pair source="id" target="id"/>
+	</db-relationship>
+	<obj-relationship name="groupMembers" source="Group" target="Role" deleteRule="Nullify"
db-relationship-path="group_members.role"/>
+	<obj-relationship name="groupProperties" source="Group" target="GroupProperties" deleteRule="Cascade"
db-relationship-path="group_properties"/>
+	<obj-relationship name="group" source="GroupProperties" target="Group" deleteRule="Nullify"
db-relationship-path="group"/>
+	<obj-relationship name="roleGroups" source="Role" target="Group" deleteRule="Nullify"
db-relationship-path="role_groups.group"/>
+	<obj-relationship name="userProperties" source="User" target="UserProperties" deleteRule="Cascade"
db-relationship-path="user_properties"/>
+	<obj-relationship name="user" source="UserProperties" target="User" deleteRule="Nullify"
db-relationship-path="user"/>
+</data-map>

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml?rev=905960&r1=905959&r2=905960&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/resources/spring-test-resources.xml
Wed Feb  3 09:53:40 2010
@@ -109,6 +109,9 @@
     <bean id="QuoteMap" class="org.apache.cayenne.unit.DataMapFactory">
         <constructor-arg><value>quotemap.map.xml</value></constructor-arg>
     </bean>
+    <bean id="InheritanceFlatMap" class="org.apache.cayenne.unit.DataMapFactory">
+        <constructor-arg><value>inheritance-flat.map.xml</value></constructor-arg>
+    </bean>
     
 	
 	<!-- ======================================= -->
@@ -183,6 +186,11 @@
         <constructor-arg><ref bean="DataSetFactory"/></constructor-arg>
         <constructor-arg><list><ref bean="QuoteMap"/></list></constructor-arg>
     </bean>
+	<bean id="InheritanceFlatStack" class="org.apache.cayenne.unit.SimpleAccessStack">
+		<constructor-arg><ref bean="TestResources"/></constructor-arg>
+		<constructor-arg><ref bean="DataSetFactory"/></constructor-arg>
+		<constructor-arg><list><ref bean="InheritanceFlatMap"/></list></constructor-arg>
+	</bean>
 	<!-- Used to create DB schema to avoid conflicts when schema for individual stacks is
generated. -->
 	<bean id="SchemaSetupStack" class="org.apache.cayenne.unit.SimpleAccessStack">
 		<constructor-arg><ref bean="TestResources"/></constructor-arg>
@@ -201,6 +209,7 @@
 				<ref bean="QualifiedMap"/>
                 <ref bean="InheritanceMap"/>
                 <ref bean="QuoteMap"/>
+				<ref bean="InheritanceFlatMap"/>
 			</list>
 		</constructor-arg>
 	</bean>



Mime
View raw message