Snippets

Karolis Jocevičius Java - Hibernate - stored function call

Created by Karolis Jocevičius last modified
String functionString = configFacade.getByKey(FUNCTION_STRING);
		
Session session = getEntityManager().unwrap(Session.class);
final StringBuilder result = new StringBuilder();

session.doWork(new Work() {
	@Override
	public void execute(Connection conn) throws SQLException {
		CallableStatement call = conn.prepareCall("{? = call " + functionString + "(?)}");
		call.registerOutParameter(1, Types.VARCHAR);
		call.setString(2, item.getCode());
		call.execute();
		result.append(call.getString(1));
	}
});
return result.toString();

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.