Oracle SQL:
create or replace TYPE some_array AS TABLE OF NUMBER;
create or replace procedure custom_procedure(array_param IN some_array) (...)
我正在使用org.eclipse.persistence 2.x作为JPA的一个实现,所以理论上它应该支持这样的操作。
代码:
//(... retrieve EntityManager instance => em ...)
StoredProcedureQuery storedProcedure = entityManager.createStoredProcedureQuery("custom_procedure");
storedProcedure.registerStoredProcedureParameter("array_param", Long[].class, ParameterMode.IN);
storedProcedure.setParameter("array_param", new Long[] { 2L });
storedProcedure.executeUpdate();
上面我得到:
Internal Exception: java.sql.SQLException: Invalid column type
Error Code: 17004