我试图从 postgresSql 函数中获取数据,我在这里使用了这个例子
在具有 IN/OUT 数据的映射类下方:
@XmlType(name="AccountRR")
@NamedStoredProcedureQuery
(
name="getAccountMapping",
procedureName="accountFunction",
parameters = {
@StoredProcedureParameter(name="in_route", mode=ParameterMode.IN, type=String.class),
@StoredProcedureParameter(name="in_round", mode=ParameterMode.IN, type=String.class)
},
resultSetMappings={"AccountRouteRoundMapping"}
)
@SqlResultSetMapping
(
name = "AccountRouteRoundMapping",
entities =
{
@EntityResult
(
entityClass = AccountRouteRound.class,
fields =
{
@FieldResult(name = "name", column = "name"),
@FieldResult(name = "address_1", column = "address_1"),
@FieldResult(name = "address_2", column = "address_2")
[....]
}
)
}
)
public class AccountRouteRound {.............}
在我调用 createNamedStoredProcedureQuery 的类下面
public static List<Account> getAccount(....)
{
em.getTransaction().begin();
StoredProcedureQuery spq = em.createNamedStoredProcedureQuery("getAccountMapping");
List CustomerRRDList = spq.getResultList();
em.getTransaction().commit();
}
我收到了这个错误:
**Caused by: java.lang.IllegalArgumentException: No @NamedStoredProcedureQuery was found with that name : getAccountMapping**
我应该在哪里插入注释?怎么了 ?
谢谢