Spring Data Neo4j
  1. Spring Data Neo4j
  2. DATAGRAPH-267

Collection properties - contains returns true but remove returns false

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1.RC3
    • Component/s: CORE
    • Labels:
      None
    • Environment:
      Using the simple mapping.

      Description

      In some cases a "parent" entity which contains a Set of child entities will not allow you to remove chile entities from the collection, even if it exists in the collection.

      If you call contains on the collection and it returns true, then remove should transitively also return true. If the object is in the collection, then it should be removable.

      In looking at the SDN code, the wrapper collection just passes the remove call to the delegate collection, and it appears that that is returning the false. So in essence, it looks like the JDK collection is the one broken. However, because we have proxies and some other wrappers around our objects, it might be putting in a wrapped object into the collection for the entity.

        Activity

        Hide
        Michael Hunger added a comment -

        Weird, I have a test-case in SDN that works where remove() also returns true.

        Show
        Michael Hunger added a comment - Weird, I have a test-case in SDN that works where remove() also returns true.
        Hide
        Mark Spritzler added a comment -

        Yep, I also have a few Collections where it works perfectly. And in all the domain objects I have, the equals/hashcode code is basically the same code. Just different object types, but same property name for id, same code copied/pasted in each domain, and then just changed the type to the domain type.

        I'll see what I can do to isolate it and post example. But it is tough to do that when you have a full blown app around it all.

        Show
        Mark Spritzler added a comment - Yep, I also have a few Collections where it works perfectly. And in all the domain objects I have, the equals/hashcode code is basically the same code. Just different object types, but same property name for id, same code copied/pasted in each domain, and then just changed the type to the domain type. I'll see what I can do to isolate it and post example. But it is tough to do that when you have a full blown app around it all.
        Hide
        Mark Spritzler added a comment -

        Sample app with test to test this out. Currently though I can't get the ItemSignedUp to show in the User's Collection. Check the TemporaryData.java class and look at the end how I add the items to a user. Specifically gUser

        Show
        Mark Spritzler added a comment - Sample app with test to test this out. Currently though I can't get the ItemSignedUp to show in the User's Collection. Check the TemporaryData.java class and look at the end how I add the items to a user. Specifically gUser
        Hide
        Lasse Westh-Nielsen added a comment -

        We know what the issue is and how to work around it: spring.neo4j.org/docs#d5e807

        So, not fixing as such, but the workarounds should be good enough.

        Show
        Lasse Westh-Nielsen added a comment - We know what the issue is and how to work around it: spring.neo4j.org/docs#d5e807 So, not fixing as such, but the workarounds should be good enough.

          People

          • Assignee:
            Lasse Westh-Nielsen
            Reporter:
            Mark Spritzler
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: