org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'Department' to required type 'java.lang.Long' for property 'department'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [Department] to required type [java.lang.Long] for property 'department': PropertyEditor [org.springframework.beans.propertyeditors.CustomNumberEditor] returned inappropriate value of type [Department]

Spring JIRA | Romain Fromi | 4 years ago
  1. 0

    I am trying to reproduce this jpa model : http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Entities/Ids/IdClass#Example:_Composite_Primary_Key_Class_With_Foreign_Key When I try to create a new Employee, if have the following stack trace : org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'Department' to required type 'java.lang.Long' for property 'department'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [Department] to required type [java.lang.Long] for property 'department': PropertyEditor [org.springframework.beans.propertyeditors.CustomNumberEditor] returned inappropriate value of type [Department] at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:490) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1119) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:904) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$DirectFieldAccessFallbackBeanWrapper.setPropertyValue(JpaMetamodelEntityInformation.java:205) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.getId(JpaMetamodelEntityInformation.java:94) at org.springframework.data.repository.core.support.AbstractEntityInformation.isNew(AbstractEntityInformation.java:53) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:340) ... The problem comes from JpaMetamodelEntityInformation.getId : this method ignores the fact that the id class contains the id of the department, not a department reference. NB : in this issue https://jira.springsource.org/browse/DATAJPA-50, the same situation was described in a comment : https://jira.springsource.org/browse/DATAJPA-50?focusedCommentId=66633&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-66633 Thanks for reading

    Spring JIRA | 4 years ago | Romain Fromi
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'Department' to required type 'java.lang.Long' for property 'department'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [Department] to required type [java.lang.Long] for property 'department': PropertyEditor [org.springframework.beans.propertyeditors.CustomNumberEditor] returned inappropriate value of type [Department]
  2. 0

    JPA + EclipseLink + Spring Data -- Composite Primary Key Issues

    Stack Overflow | 1 year ago | coryfoo
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'model.UserPK' to required type 'java.lang.Long' for property 'id'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [model.UserPK] to required type [java.lang.Long] for property 'id': PropertyEditor [org.springframework.beans.propertyeditors.CustomNumberEditor] returned inappropriate value of type [model.UserPK]
  3. 0

    Combobox selection value is not converted when the combobox dropdown is opened and closed without change. When I change the value or if I don't even click the dropdown everthing is fine. Reported Exception (LifeCycle$State is a org.springframework.core.enums.ShortCodedLabeledEnum 8.11.2005 17:41:54 WARNING Exception occurred executing dialog finish command. org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [de.innovations.wfr.model.gbz.LifeCycle$State] for property 'lifeCycleState' at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:1103) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:849) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:733) at org.springframework.binding.support.BeanPropertyAccessStrategy$BeanPropertyValueModel.setValue(BeanPropertyAccessStrategy.java:259) at org.springframework.binding.value.support.AbstractValueModel.setValueSilently(AbstractValueModel.java:54) at org.springframework.binding.value.support.BufferedValueModel.commit(BufferedValueModel.java:197) at org.springframework.binding.value.support.BufferedValueModel$CommitTriggerHandler.commit(BufferedValueModel.java:264) at org.springframework.binding.value.CommitTrigger.commit(CommitTrigger.java:45) at org.springframework.binding.form.support.AbstractFormModel.doCommit(AbstractFormModel.java:485) at org.springframework.binding.form.support.AbstractFormModel.commit(AbstractFormModel.java:467) at org.springframework.richclient.form.AbstractForm.commit(AbstractForm.java:531)

    Spring JIRA | 1 decade ago | Gerald Glocker
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [de.innovations.wfr.model.gbz.LifeCycle$State] for property 'lifeCycleState'
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Combobox selection value is not converted when the combobox dropdown is opened and closed without change. When I change the value or if I don't even click the dropdown everthing is fine. Reported Exception (LifeCycle$State is a org.springframework.core.enums.ShortCodedLabeledEnum 8.11.2005 17:41:54 WARNING Exception occurred executing dialog finish command. org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [de.innovations.wfr.model.gbz.LifeCycle$State] for property 'lifeCycleState' at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:1103) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:849) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:733) at org.springframework.binding.support.BeanPropertyAccessStrategy$BeanPropertyValueModel.setValue(BeanPropertyAccessStrategy.java:259) at org.springframework.binding.value.support.AbstractValueModel.setValueSilently(AbstractValueModel.java:54) at org.springframework.binding.value.support.BufferedValueModel.commit(BufferedValueModel.java:197) at org.springframework.binding.value.support.BufferedValueModel$CommitTriggerHandler.commit(BufferedValueModel.java:264) at org.springframework.binding.value.CommitTrigger.commit(CommitTrigger.java:45) at org.springframework.binding.form.support.AbstractFormModel.doCommit(AbstractFormModel.java:485) at org.springframework.binding.form.support.AbstractFormModel.commit(AbstractFormModel.java:467) at org.springframework.richclient.form.AbstractForm.commit(AbstractForm.java:531)

    Spring JIRA | 1 decade ago | Gerald Glocker
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [de.innovations.wfr.model.gbz.LifeCycle$State] for property 'lifeCycleState'
  6. 0

    Failed to convert property value of type[il.siqee.common.logging.custom.CustomLogger] to required type [il.siqee.common.logging.custom.CustomLogger]

    Stack Overflow | 1 year ago | Justin
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [il.siqee.common.logging.custom.CustomLogger] to required type [il.siqee.common.logging.custom.CustomLogger] for property 'customLogger'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [il.siqee.common.logging.custom.CustomLogger] to required type [il.siqee.common.logging.custom.CustomLogger] for property 'customLogger': no matching editors or conversion strategy found

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.beans.TypeMismatchException

      Failed to convert property value of type 'Department' to required type 'java.lang.Long' for property 'department'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [Department] to required type [java.lang.Long] for property 'department': PropertyEditor [org.springframework.beans.propertyeditors.CustomNumberEditor] returned inappropriate value of type [Department]

      at org.springframework.beans.BeanWrapperImpl.convertIfNecessary()
    2. Spring Beans
      BeanWrapperImpl.setPropertyValue
      1. org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:490)
      2. org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
      3. org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1119)
      4. org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:904)
      4 frames
    3. Spring Data JPA
      JpaMetamodelEntityInformation.getId
      1. org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$DirectFieldAccessFallbackBeanWrapper.setPropertyValue(JpaMetamodelEntityInformation.java:205)
      2. org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.getId(JpaMetamodelEntityInformation.java:94)
      2 frames
    4. Spring Data Core
      AbstractEntityInformation.isNew
      1. org.springframework.data.repository.core.support.AbstractEntityInformation.isNew(AbstractEntityInformation.java:53)
      1 frame
    5. Spring Data JPA
      SimpleJpaRepository.save
      1. org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:340)
      1 frame