Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor 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).

        Activity

        Hide
        Oliver Gierke added a comment -

        Currently the repository query parameter binding does not regard the MappingContext information but only converts the given parameters without context. As we're quite into the 1.0 roadmap already I have documented the limitation for now and schedule the fix for the first 1.1 milestone.

        Show
        Oliver Gierke added a comment - Currently the repository query parameter binding does not regard the MappingContext information but only converts the given parameters without context. As we're quite into the 1.0 roadmap already I have documented the limitation for now and schedule the fix for the first 1.1 milestone.
        Hide
        Oliver Gierke added a comment -

        Fixed in 1.1.0 branch. Deployed to snapshot repo.

        Show
        Oliver Gierke added a comment - Fixed in 1.1.0 branch. Deployed to snapshot repo.
        Hide
        Jitender Saini added a comment -

        Hi! Oliver,

        I'm using mongodb driver version 2.8.0 and <spring.data.mongodb.version>1.0.2.RELEASE</spring.data.mongodb.version>

        But I've seen that still the same problem persists. Can you please provide me a code snippet how to handle above listed scenario.

        Thanks

        Jitender Saini

        Show
        Jitender Saini added a comment - Hi! Oliver, I'm using mongodb driver version 2.8.0 and <spring.data.mongodb.version>1.0.2.RELEASE</spring.data.mongodb.version> But I've seen that still the same problem persists. Can you please provide me a code snippet how to handle above listed scenario. Thanks Jitender Saini
        Hide
        David Dossot added a comment -

        @Jitender: this has been fixed in 1.1 M1, not 1.0.2.RELEASE.

        Show
        David Dossot added a comment - @Jitender: this has been fixed in 1.1 M1, not 1.0.2.RELEASE.
        Hide
        Antti Tirkkonen added a comment -

        Is there possibility to get back the collection parameter for DbRef? Or is the similar functionality provided now some other way?

        Example:
        @DBRef(collection = "yourOwnCollectionName")
        private Application app;

        Show
        Antti Tirkkonen added a comment - Is there possibility to get back the collection parameter for DbRef? Or is the similar functionality provided now some other way? Example: @DBRef(collection = "yourOwnCollectionName") private Application app;

          People

          • Assignee:
            Oliver Gierke
            Reporter:
            Andrea Vacondio
          • Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: