public List<Object> findAllEntityListBySearch(Long inputInfoId, int flag) throws Exception {
List<Object> infoviewList=new ArrayList<>();
EntityManager em = emf.createEntityManager();
try {
StoredProcedureQuery storedProcedure =em.createStoredProcedureQuery("存储名称");

//下面是参数
storedProcedure.registerStoredProcedureParameter("InputInfoID", Integer.class, ParameterMode.IN);
storedProcedure.registerStoredProcedureParameter("Flags", Integer.class, ParameterMode.IN);

//参数赋值
storedProcedure.setParameter("InputInfoID",inputInfoId.intValue());
storedProcedure.setParameter("Flags",flag);

//返回list
infoviewList=storedProcedure.getResultList();
storedProcedure.execute();
} catch (Exception ex) {
logger.error("{} method thrown exception++++++","findAllEntityListBySearch", ex);
} finally {
em.close();
}
return infoviewList;
}

posted on 2017-08-07 11:19  三人之行,必有我师  阅读(1043)  评论(0编辑  收藏  举报