java.lang.IllegalArgumentException: Multiple constructors with arguments found in class java.math.BigDecimal! Annotate one with @PreferedConstructor explicitly to select it to be used in persistence operations.

Spring JIRA | Sergey Alaev | 6 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Exception when trying to save an object with field of type java.math.BigDecimal This data type is quite popular and should be supported natively. java.lang.IllegalArgumentException: Multiple constructors with arguments found in class java.math.BigDecimal! Annotate one with @PreferedConstructor explicitly to select it to be used in persistence operations. at org.springframework.data.mapping.PreferredConstructorDiscoverer.<init>(PreferredConstructorDiscoverer.java:81) at org.springframework.data.mapping.BasicPersistentEntity.<init>(BasicPersistentEntity.java:49) at org.springframework.data.document.mongodb.mapping.BasicMongoPersistentEntity.<init>(BasicMongoPersistentEntity.java:47) at org.springframework.data.document.mongodb.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:59) at org.springframework.data.document.mongodb.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:33) at org.springframework.data.mapping.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:164) at org.springframework.data.mapping.AbstractMappingContext$1.doWith(AbstractMappingContext.java:201) at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:513) at org.springframework.data.mapping.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:176) at org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:133) at org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:114) at org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:58) at org.springframework.data.document.mongodb.convert.MappingMongoConverter.writeInternal(MappingMongoConverter.java:316) at org.springframework.data.document.mongodb.convert.MappingMongoConverter.write(MappingMongoConverter.java:287)

    Spring JIRA | 6 years ago | Sergey Alaev
    java.lang.IllegalArgumentException: Multiple constructors with arguments found in class java.math.BigDecimal! Annotate one with @PreferedConstructor explicitly to select it to be used in persistence operations.
  2. 0

    Exception when trying to save an object with field of type java.math.BigDecimal This data type is quite popular and should be supported natively. java.lang.IllegalArgumentException: Multiple constructors with arguments found in class java.math.BigDecimal! Annotate one with @PreferedConstructor explicitly to select it to be used in persistence operations. at org.springframework.data.mapping.PreferredConstructorDiscoverer.<init>(PreferredConstructorDiscoverer.java:81) at org.springframework.data.mapping.BasicPersistentEntity.<init>(BasicPersistentEntity.java:49) at org.springframework.data.document.mongodb.mapping.BasicMongoPersistentEntity.<init>(BasicMongoPersistentEntity.java:47) at org.springframework.data.document.mongodb.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:59) at org.springframework.data.document.mongodb.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:33) at org.springframework.data.mapping.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:164) at org.springframework.data.mapping.AbstractMappingContext$1.doWith(AbstractMappingContext.java:201) at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:513) at org.springframework.data.mapping.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:176) at org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:133) at org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:114) at org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:58) at org.springframework.data.document.mongodb.convert.MappingMongoConverter.writeInternal(MappingMongoConverter.java:316) at org.springframework.data.document.mongodb.convert.MappingMongoConverter.write(MappingMongoConverter.java:287)

    Spring JIRA | 6 years ago | Sergey Alaev
    java.lang.IllegalArgumentException: Multiple constructors with arguments found in class java.math.BigDecimal! Annotate one with @PreferedConstructor explicitly to select it to be used in persistence operations.

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Multiple constructors with arguments found in class java.math.BigDecimal! Annotate one with @PreferedConstructor explicitly to select it to be used in persistence operations.

      at org.springframework.data.mapping.PreferredConstructorDiscoverer.<init>()
    2. Spring Data Core
      BasicPersistentEntity.<init>
      1. org.springframework.data.mapping.PreferredConstructorDiscoverer.<init>(PreferredConstructorDiscoverer.java:81)
      2. org.springframework.data.mapping.BasicPersistentEntity.<init>(BasicPersistentEntity.java:49)
      2 frames
    3. org.springframework.data
      MongoMappingContext.createPersistentEntity
      1. org.springframework.data.document.mongodb.mapping.BasicMongoPersistentEntity.<init>(BasicMongoPersistentEntity.java:47)
      2. org.springframework.data.document.mongodb.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:59)
      3. org.springframework.data.document.mongodb.mapping.MongoMappingContext.createPersistentEntity(MongoMappingContext.java:33)
      3 frames
    4. Spring Data Core
      AbstractMappingContext$1.doWith
      1. org.springframework.data.mapping.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:164)
      2. org.springframework.data.mapping.AbstractMappingContext$1.doWith(AbstractMappingContext.java:201)
      2 frames
    5. Spring Core
      ReflectionUtils.doWithFields
      1. org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:513)
      1 frame
    6. Spring Data Core
      AbstractMappingContext.getPersistentEntity
      1. org.springframework.data.mapping.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:176)
      2. org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:133)
      3. org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:114)
      4. org.springframework.data.mapping.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:58)
      4 frames
    7. org.springframework.data
      MappingMongoConverter.write
      1. org.springframework.data.document.mongodb.convert.MappingMongoConverter.writeInternal(MappingMongoConverter.java:316)
      2. org.springframework.data.document.mongodb.convert.MappingMongoConverter.write(MappingMongoConverter.java:287)
      2 frames