Hey Max,
Just when I was getting to explore JDBC support for Hibernate, in section 17.4 of the documentation i found that stored proc and custom insert, update, delete queries are supoprted in Hibernate3. It also states "The SQL is directly executed in your database, so you are free to use any dialect you like."
Code:
<class name="Person">
<id name="id">
<generator class="increment"/>
</id>
<property name="name" not-null="true"/>
<sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )</sql-insert>
<sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-update>
<sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>
</class>
Strored procs can be called as
Code:
<class name="Person">
<id name="id">
<generator class="increment"/>
</id>
<property name="name" not-null="true"/>
<sql-insert callable="true">{call createPerson (?, ?)}</sql-insert>
<sql-delete callable="true">{? = call deletePerson (?)}</sql-delete>
<sql-update callable="true">{? = call updatePerson (?, ?)}</sql-update>
</class>
But what doc does not mention is how is this used in the code. Can you tell me how is this used in the code and if there is anything special I need to use this.
Thanks!