I have a stored function called getNextCode()
that requires a string parameter and returns a string. I wish to call this from my JPA enabled application. T
he following code fragment shows the use of the crateNativeQuery()
method to achieve this.
private String _getNextRollPackageCode() { String query = String.format( "SELECT getNextCode( '%s')", this.ROLL_PACKAGES_MODEL_NAME ); return this.ROLL_PACKAGE_CODE_PREFIX + "-" + (String) _entityManager.createNativeQuery(query) .getSingleResult(); }
No comments :
Post a Comment