I have a problem with how Hibernate cascading updates to associations that I don't want updated. I know that this is a simple question, but everywhere I've looked tells me it should be working differently from what I'm seeing. So, here goes: if I want to be able to update an entity without updating an associated entity, I shouldn't have to do anything special, right? That is, cascade is set to none by default. In fact, I've even explicitly set it as such in my mapping file. However, what I'm seeing is that when I update a Foo, the show_sql output indicates that its Bar is also being updated. Can anybody see what I'm doing wrong?
Hibernate version:
3.2
Mapping documents:
The relevant portion is this snippet:
Code:
<hibernate-mapping>
<class table="FOO" name="org.ah.carescribe.Foo">
...
<many-to-one column="bar_id" property-ref="title" cascade="none" name="form" class="org.ah.questionairre.Bar"/>
...
</class>
</hibernate-mapping>
... and this one ...
Code:
<hibernate-mapping>
<class table="BAR" name="org.ah.questionairre.Baz">
...
<subclass name="org.ah.questionairre.Bar" discriminator-value="Bar">
<property name="shortTitle" column="shortTitle" length="5"/>
</subclass>
...
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():A whole bunch. I use a single-session-per-thread pattern.
Full stack trace of any exception that occurs:N/A
Name and version of the database you are using:DB2/400 - V5R2
The generated SQL (show_sql=true):Code:
Hibernate: insert into FOO (ahkey, ahadtk, ahusid, ahbgdt, ahuldt, ahfmid, ahstat) values (default, ?, ?, ?, ?, ?, ?)
Hibernate: update BAR set caption=?, desc=?, title=?, blockType=?, innerBlock=?, childBlock=?, shortTitle=? where id=?