【发布时间】:2019-06-05 07:59:44
【问题描述】:
我有这个
DECLARE
c number;
BEGIN
c := get_next_unlocked_id();
DBMS_OUTPUT.put_line('id: ' || c);
END;
此查询打印函数结果。但我需要在我的 Spring 数据 JPA 存储库或 entitiManager 中返回这个结果。
我试试这个:
@Override
public Long getOld() {
Long id = (Long) em.createNativeQuery("SELECT get_next_unlocked_id() FROM DUAL").getSingleResult();
return id;
}
但我得到错误:
2019-01-10 15: 28: 25.768 ERROR 6724 --- [pool-1-thread-2] o.h.engine.jdbc.spi.SqlExceptionHelper: ORA-14551: the DML operation cannot be performed inside the request
ORA-06512: on "MY.GET_NEXT_UNLOCKED_ID", line 8
【问题讨论】:
标签: java oracle function spring-data-jpa entitymanager