JPA EclipseLink 使用 Clob 参数调用 NamedStoredProcedureQuery(IN 和 OUT)
JPA EclipseLink Call NamedStoredProcedureQuery with Clob parameter (IN and OUT)
提示如何更好地调用带有输入参数(Clob)的过程,然后解析输出参数。 (Clob)
对于 JDBC 我找到了 this case。我如何使用 JPA 和 EclipseLink
来实现它
创建 Clob:
Clob clobR = null;
try {
Connection conn = em.unwrap(Connection.class);
java.sql.Connection con2 = conn.getMetaData().getConnection();
clobR = con2.createClob();
clobR.setString(START_POSITION, data);
} catch (SQLException e) {
e.printStackTrace();
}
调用程序:
StoredProcedureQuery query = em.createStoredProcedureQuery(name);
query.registerStoredProcedureParameter(paramName, type, mode);
query.setParameter(paramName, value);
提示如何更好地调用带有输入参数(Clob)的过程,然后解析输出参数。 (Clob)
对于 JDBC 我找到了 this case。我如何使用 JPA 和 EclipseLink
来实现它创建 Clob:
Clob clobR = null;
try {
Connection conn = em.unwrap(Connection.class);
java.sql.Connection con2 = conn.getMetaData().getConnection();
clobR = con2.createClob();
clobR.setString(START_POSITION, data);
} catch (SQLException e) {
e.printStackTrace();
}
调用程序:
StoredProcedureQuery query = em.createStoredProcedureQuery(name);
query.registerStoredProcedureParameter(paramName, type, mode);
query.setParameter(paramName, value);