Я использую PostgreSQL.В этом я создал функцию.Я хочу вызвать эту функцию в сервисный метод. Я создал хранилище для этой функции, используя собственный запрос.Но я не могу получить результат, который я получаю при запуске функции в PostgreSQL DB.Я получаю исключение типа «Не найден конвертер, способный преобразовать тип [java.math.BigDecimal] в тип [com.spacestudy.model.DeptListForJointusePer]».
Модель:
@Entity
public class DeptListForJointusePer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column
public Integer p_nDeptID;
@Column
public Integer res_salaryPercent;
@Column
public Integer res_nClientCPCMappingId;
@Column
public String res_CPCCODE ;
@Column
public String res_sDeptName ;
@Column
public String res_sClientDeptId ;
@Column
@JsonProperty(value = "text")
public String res_sAlternateJointUsePercentage;
//getters and setters
Репозиторий:
@Query(nativeQuery = true, value = "SELECT * from GetDeptListForViewModifyJointUsePercentages(:p_nInstID,:p_nDeptID)")
List<DeptListForJointusePer> getDeptListForViewModifyJointUsePercentages(@Param("p_nInstID")Integer p_nInstID,@Param("p_nDeptID") Integer p_nDeptID);
Сервис:
public List<DeptListForJointusePer> getDeptListForViewModifyJoinyusePer(Integer p_nInstID,Integer p_nDeptID) {
List<DeptListForJointusePer> result = roomDeptMapRepoObj.getDeptListForViewModifyJointUsePercentages(p_nInstID, p_nDeptID);
return result;
}
Контроллер:
@GetMapping("/function")
public List<DeptListForJointusePer> function(@RequestParam(value="p_nInstID",required=true)Integer p_nInstID
,@RequestParam(value="p_nDeptID",required=true)Integer p_nDeptID){
return roomDeptMapServiceObj.getDeptListForViewModifyJoinyusePer(p_nInstID, p_nDeptID);
}
ошибка:
Failed to convert from type [java.lang.Object[]] to type [com.spacestudy.model.DeptListForJointusePer] for value '{21714, 12.50000000000000000000, 7, IDR, Electron Microscopy Resource Center, 111070, YES}';
nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.math.BigDecimal] to type [com.spacestudy.model.DeptListForJointusePer]