1
我需要从JPA调用Sybase存储过程,并将值返回到将用于填充另一个持久对象的Transient对象。从JPA/Hibernate调用Sybase存储过程
这是我做了什么:
@Entity
public class CBSCustomer {
String cpr;
<--snipped-->
@Id
@Transient
public String getCpr() {
return cpr;
}
<---snipped-->
}
呼叫到SP在豆:
List<CBSCustomer> fetchedCustomerList = getEmPhoenix().createNativeQuery("{call sp_name(?)}", CBSCustomer.class).setParameter(1, cprInput).getResultList();
if (fetchedCustomerList.size() > 0) {
CBSCustomer cbsCustomer = ((CBSCustomer)fetchedCustomerList.get(0));
setDisabled(true);
}
不幸的是我不断收到错误抱怨列名,即“无效列名称为X”,其中x是CBSCustomer中我的字段的占位符。
感谢您分享您的答案! –