Spring Data MongoDB
  1. Spring Data MongoDB
  2. DATAMONGO-592

Persisting Objects containing Objects with PersistenceConstructor causes MappingInstantiationException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.2 GA
    • Component/s: Mapping
    • Labels:
    • Environment:
      Java JDK 1.7u10

      Description

      I am able to persist an object and have SringSource re-create the object from the database if all the member variables are primitive types. This holds true if the names of the @PersistenceConstructor arguments don't match exactly the names of the member variables - in this case they an be matched up by using the @Field("foo") and @Value("#root.foo") annotations. However, I get a MappingInstantiationException when I try to persist objects that contain other objects using the @PersistenceConstructor.

      See StackOverflow 13854753 and StackOverflow 13832188 for details.

      According to Oliver Gierke:

      You seem to have found a bug. The value resulting from the first Spel expression evaluation is a DBObject and not actually translated into the parameter type. I've already have some code here locally that fixes that. Would you mind creating a ticket against Spring Data MongoDB to file this as a bug?

        Issue Links

          Activity

          Hide
          Oliver Gierke added a comment -

          Should be fixed. Would you mind giving 1.2.0.BUILD-SNAPSHOT a chance?

          Show
          Oliver Gierke added a comment - Should be fixed. Would you mind giving 1.2.0.BUILD-SNAPSHOT a chance?
          Hide
          Ben Baumgold added a comment -

          Yep, seems like it works. Thank you. When is version 1.2 scheduled to be released?

          Show
          Ben Baumgold added a comment - Yep, seems like it works. Thank you. When is version 1.2 scheduled to be released?
          Hide
          Oliver Gierke added a comment -

          Second week of January. We'll be going GA right away.

          Show
          Oliver Gierke added a comment - Second week of January. We'll be going GA right away.

            People

            • Assignee:
              Oliver Gierke
              Reporter:
              Ben Baumgold
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: