Ok It seems that you are using a projection over the entity CreditCenter
@Query("SELECT CC.id, CC.loanId, CC.clientId FROM CreditCenter CC")
My first thought is :
Why you dont use something like this.
@Query("SELECT CC FROM CreditCenter CC")
that will return the list of the entities, however probably you dont want to return all the fields so my second advice is use this query.
@Query("SELECT new package.to.CreditCenter(CC.id, CC.loanId, CC.clientId) FROM CreditCenter CC")
and add a constructor in Creditcenter that support the order and type of parameters. That will work using JPQL and as jpa repos use that it should work.
public class CreditCenter {
//Member vars
public CreditCenter (int id, int loadid, int clientid){...}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…