ConverterNotFoundException:从类型[java.math.BigDecimal]到类型[com.spacestudy.model.DeptListForJointusePer]

时间:2019-04-03 07:38:30

标签: postgresql spring-data-jpa

我正在使用PostgreSQL。在那我创建了一个函数。我想将该函数调用到服务方法中。我使用本机查询为该函数创建了存储库。但是我无法获得在PostgreSQL数据库中运行该函数时得到的结果。我遇到了类似“没有找到能够将[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]

0 个答案:

没有答案
相关问题