See:
http://docs.jboss.org/hibernate/stable/ ... erysql-cudThis is either incomplete or plain wrong.
For example, the hbm example shows this:
Code:
<sql-delete callable="true">{? = call deletePerson (?)}</sql-delete>
<sql-update callable="true">{? = call updatePerson (?, ?)}</sql-update>
They both do not work, as there are too many parameters. The error is:
Code:
Hibernate: {? = call deletePerson (?)}
WARN o.h.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22023
ERROR o.h.util.JDBCExceptionReporter - No value specified for parameter 2.
Update reports "no value for parameter 3.
The working code is like this:
Code:
<sql-delete callable="true">{call deletePerson (?)}</sql-delete>
<sql-update callable="true">{call updatePerson (?, ?)}</sql-update>
But that still does not work, it reports:
Code:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:85)
The check attribute is needed.
The actually working mapping file is (from actual project):
Code:
<sql-insert check="none" callable="true">{call mydb.createFooHB (?, ?, ?, ?, ?, ?, ?, ?)}</sql-insert>
<sql-update check="none" callable="true">{call mydb.updateFooHB(?, ?, ?, ?, ?, ?, ?, ?)}</sql-update>
<sql-delete check="none" callable="true">{call mydb.deleteFooHB (?)}</sql-delete>
Please someone update or clarify the documentation.
What would be required to have it work without check="none" ?
Currently I use hibernate-core-3.3.2.GA, I will check if the latest version behaves differently.
Regards,
David