Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-592

Persisting Objects containing Objects with PersistenceConstructor causes MappingInstantiationException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olivergierke Oliver Gierke
                Reporter:
                ben.baumgold Ben Baumgold
                Last updater:
                Trevor Marshall
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: