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]

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web7

  • via Unknown by Romain Fromi,
  • via Unknown by Gerald Glocker,
  • 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)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    KawadaKawada
    2 times, last one