java - Hibernate: How configure entity to be inserted/updated/deleted through Oracle package procedures? -


is possible (and if yes, how?) map entity class fetched table, inserted/updated/deleted through procedures, instead of doing insert/update/delete on table?

entity configuration done via xml, , using classes/methods specific oracle ok.

you can map custom sql create/update/delete operations since version 3.5.

if want map through regular sql statements, can write sql inside <sql-insert>, <sql-update>, <sql-delete> elements.

when using stored procedures, need mark them callable statements , use call syntax. note required out parameters delete , update, returning amount of rows removed.

<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> 

Comments