-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Cascade Usage Issue
PostPosted: Mon Jul 30, 2007 3:40 pm 
Newbie

Joined: Mon Jul 30, 2007 2:25 pm
Posts: 1
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=?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.