hello all, I need help with a stored procedure for inseting records in a postgres table: i have the mapping file whith this configuration: <hibernate-mapping> <class name="blom.log.model.xhostclass" table="x_hosts"> <id name="iId" column="pk_codehost" type="int" unsaved-value="-1"> <generator class="identity"> </generator> </id> <property name="sHost" type="java.lang.String" access="field"> <column name="d_host" /> </property> <sql-insert callable="true" check="none"> {call insert_host(:dHost)} </sql-insert>
</class> </hibernate-mapping>
My problem is that i don't know how to refer that in java code, how to execute the procedure. I'm trying something like
Transaction tx = null; tx = session.beginTransaction(); Query query = session.getNamedQuery("insert_host"); query.setString("dHost", "host1"); query.executeUpdate();
but the error is Named query not known: insert_host
Any help please??? thanks in advance.
|