Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0 RC1
    • Fix Version/s: 1.1 M1
    • Component/s: Repository
    • Labels:

      Description

      I have an Entity which has a User mapped as a @DBRef, something like:

      Entity.java
      @Document
      public class Entity extends PersistentEntity {
         
          @DBRef
          private User user;
          ......
      }
      

      When Entity is stored in Mongo I correctly get something like:

      ......
      	"user" : {
      		"$ref" : "user",
      		"$id" : ObjectId("4ee4b93ff5984b517d6d44ed")
      	}
      .......
      

      Now in my EntityRepository I added a findByUser(User user) which fails creating this query:

      Created query { "user" : { "_id" : { "$oid" : "4ee4c1c2f598e176cd781046"} , "userName" : "Chuck Norris"}}
      

      The generated query would be correct if User wouldn't be stored as a DBRef.
      I don't think this is the expected behavior but if it is, it should be stated in the documentation (I couldn't find anything about that).

        Attachments

          Activity

            People

            • Assignee:
              olivergierke Oliver Gierke
              Reporter:
              torakiki Andrea Vacondio
              Last updater:
              Trevor Marshall
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: