After reviewing the documentation, I cannot see how to use sql-update in a realistic case. Given: public class Person { private Long id; // identifier private String name; private String address; private Date phone; private Person bestfriend; ... } and hibernate-mapping <class name="Person" table="person" <id name="id"> <generator class="native"/> </id> <property name="name"/> <property name="address"/> <property name="phone" /> <many-to-one name="bestfriend" column="bf" class="Person" /> ... </class>
What would be the signature for sql-update ? - especially if the person instance representing bestfriend can be deleted ?
When trying this in various scenarios I find that upon issuing the session.delete(aPerson), I see Hibernate trying to issue sql updates such as update person set bf=null where bf={deleted Person id} and when updating the person address I see: update person set name='Jane', address='123 main st', phone='123-4567', bf=789 where id=3
From the above it seems that there are at least two different signatures for sql-update needed.
DB is mysql, Hibernate version 3.3.2
|