Please, help me with the next problem: I'm calling a mysql SP with simpleJdbcCall, but i have a problem with LocalDate attribute in my bean. I hope someone can help me
SP
CREATE DEFINER=`dbadmin`@`%` PROCEDURE `SP_LIST_EQUIPMENT`()
BEGIN
SELECT `ID`,
`PO_NUMBER`,
`BRAND`,
`SKU`,
`DESCRIPTION`,
`IMEI`,
`QUANTITY`,
`DISPATCH_DATE`,
`CREATED_BY`,
`UPDATED_BY`
FROM `mandato_db`.`mandato_equipment`;
END
Bean
public class Equipment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String poNumber;
private String brand;
private String sku;
private String description;
private String imei;
private int quantity;
private LocalDate dispatchDate;
private String createdBy;
private String updatedBy;
}
Dao
@Override
public List<Equipment> list() {
String procedureName = "SP_LIST_EQUIPMENT";
simpleJdbcCall = new SimpleJdbcCall(dataSource).withProcedureName(procedureName)
.returningResultSet("equipments", BeanPropertyRowMapper.newInstance(Equipment.class));
Map<String, Object> out = simpleJdbcCall.execute();
ObjectMapper mapper = new ObjectMapper();
// Here the error occurs
List<Equipment> list = mapper.convertValue(out.get("equipments"), new TypeReference<List<Equipment>>() {});
return list;
}
StackTrace
org.springframework.dao.InvalidDataAccessApiUsageException: Cannot construct instance of
java.time.LocalDate
(no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator) at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: java.util.ArrayList[0]->pe.com.ripley.mandatobackend.bean.Equipment["dispatchDate"]); nested exception is java.lang.IllegalArgumentException: Cannot construct instance ofjava.time.LocalDate
(no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator) at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: java.util.ArrayList[0]->pe.com.ripley.mandatobackend.bean.Equipment["dispatchDate"]) at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:374)