这是我的Pojo
@Entity
@NamedStoredProcedureQuery(name = Portfolio.GET_PORTFOLIO_LIST, procedureName = "VGI_TRADESDBO.TRADELOG_PKG.GET_PORTFOLIO_LIST", resultClasses = Portfolio.class, parameters = {
@StoredProcedureParameter(type = void.class, mode = ParameterMode.REF_CURSOR) })
public class Portfolio {
static final String GET_PORTFOLIO_LIST = "GET_PORTFOLIO_LIST";
@Id
@Column(name = "fund_id")
private String fundId; //etc...
这是我的资料库
public interface PortfolioListRepository extends JpaRepository<Portfolio, String>{
@Procedure(name = Portfolio.GET_PORTFOLIO_LIST)
public List<Portfolio> runPortfolioList();
}
奇怪的是,我得到了一个ResultSet,而不是一个Portfolio对象的List。尝试按原样运行此runPortfolioListList方法会给出一个Exception in thread "main" java.lang.ClassCastException: oracle.jdbc.driver.ForwardOnlyResultSet cannot be cast to com.vanguard.gis.crims.tso.Portfolio
,但当我切换它以返回ResultSet时,效果很好。
要使Spring Magic发挥作用,我缺少什么?还是我什么都不缺,Oracle只是一个麻烦?