具有非标准名称的JPA createNativeQuery调用过程

具有非标准名称的JPA createNativeQuery调用过程,jpa,Jpa,我正在尝试使用持久性API调用Oracle过程: @TransactionAttribute(TransactionAttributeType.REQUIRED) public void removeProcess(User user, BigDecimal processId) { EntityManager em = emb.createEntityManager(user); em.createNativeQuery("{ call DOF.DF#DEL_PROCESS(?

我正在尝试使用持久性API调用Oracle过程:

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void removeProcess(User user, BigDecimal processId) {
    EntityManager em = emb.createEntityManager(user);
    em.createNativeQuery("{ call DOF.DF#DEL_PROCESS(?) }")
      .setParameter(1, processId)
      .executeUpdate();
    em.close();
}
我得到了以下例外:

Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Invalid column index
Error Code: 17003
Call: { call DOF."DF?)" }
    bind => [1 parameter bound]
如果我将DF#DEL#u过程复制到DF#DEL#u过程,所有工作都正常。如何转义?#在过程名称中?

“#”是EclipseLink内部使用的默认参数标记

您可以使用查询提示“eclipselink.jdbc.parameter delimiter”来更改这一点

此外,如果您内联参数而不是使用setParameter(),它也应该可以工作