Hi All,
I am trying to call stored procedures with hibernate to perform inserts, and got it to work partially, where each property in the mapping class is passed as a parameter to stored procedure in the order of mappings.
For example:
Code:
<class name="EventEntity" table="APP_EVENT">
<id name="id" column="APP_EVENT_ID">
<generator class="assigned" />
</id>
<property name="title" column="PAYLOAD_BIZ_EVENT_TITLE" />
<property name="userId" column="USER_ID"/>
<property name="application" column="APPLICATION_ID"/>
<!—
The order of input parameters in this case would be tittle, userId, application and finally the id.
-->
<sql-insert callable="true">{call insertEvent(?,?,?,?)}</sql-insert>
</class>
Is there a way to specify input parameters to stored procedure as named parameters, and not worry about the order of mappings in hibernate files?
I tried to replace the sql-insert with
Code:
<sql-insert callable="true">{call insertEvent(@USER_ID=?,@APPLICATION_ID=?,@APP_EVENT_TYPE_ID=?,@APP_EVENT_ID=?,@PAYLOAD_BIZ_EVENT_TITLE=?)}</sql-insert>
but it did still adhered to the order of the property mappings.
Regards,
Malay