PropertyUtils copy property error

java.lang.IllegalArgumentException: Cannot invoke com.xxx.xxx.setLeaveTime on bean class 'class com.xxx.xxx.Visitor' - argument type mismatch - had objects of type "java.lang.String" but expected signature "java. sql.Timestamp"

VO (value object) and PO (persistent object) define exactly the same fields, but the types of the fields are different (the types cannot be converted to each other), resulting in an error when using the PropertyUtils tool class to copy objects.
Lesson:
When copying objects using PropertyUtils or Beanutils utility classes, remember to keep the field types consistent between the two objects.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326133946&siteId=291194637