I'm no Hibernate expert, and I haven't tested this. However, I think the Hibernate docs, section 16.4, may explain how to do what you want (and you could get rid of the interceptor, too).
Quoting from 16.4:
Quote:
Hibernate3 can use custom SQL statements for create, update, and delete operations. The class and collection persisters in Hibernate already contain a set of configuration time generated strings (insertsql, deletesql, updatesql etc.). The mapping tags <sql-insert>, <sql-delete>, and <sql-update> override these strings:
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>
Also, since your update sql uses a subquery, shouldn't in be in parentheses?
"(select ST_POLYFROMTEXT('?',1) from dual)"