-->
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.  [ 2 posts ] 
Author Message
 Post subject: trouble disabling cascade in many-to-one mapping
PostPosted: Tue Sep 28, 2004 8:48 pm 
Newbie

Joined: Tue Sep 28, 2004 7:14 pm
Posts: 7
Hibernate version:
2.1
Mapping documents:
Code:
   <class name="org.blah.ServiceLineItem"
      table="service_order_detail"
      dynamic-update="false"
      dynamic-insert="false">

      <composite-id>
         <key-property name="webOrderId" column="serviceorderid"/>
         <key-property name="serviceCode" column="servicecode"/>
      </composite-id>
      <timestamp name="lastUpdated" column="lastmodifieddate"/>

      <property name="quantity" column="quantity"/>
      <property name="deleted" column="deletestatus" type="yes_no"/>
      <property name="shipmentStatus" column="shippedstatus"/>
      <property name="shipmentMethod" column="shippingmethodcode"/>
      <property name="shipmentDate" column="shippingdate"/>

      <many-to-one name="product" column="servicecode" cascade="none" insert="false" update="false" class="org.blah.Service"/>
   </class>



Code between sessionFactory.openSession() and session.close():
Code:
Order o = (Order) it.next();
if(o.getWebOrderId() == -1)
     session.save(o);
session.flush();



Hi,

I have a simple order model with order, detail, and product objects. There is a one-to-many relationship between the order and details and there is a many-to-one relationship between details and a product.

I'd like to cascade insert the order and details, but stop short of modifying the product object. I tried to accomplish this by setting the cascade, insert, and update atttributes, but is still trying to update my Service object. The only thing unusual about the detail mapping is that it shares a column with a composite-id (legacy database).

I feel that I must be missing something very simple. Would someone please give me a hint?

thanks,

laphroaig


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2004 11:49 am 
Newbie

Joined: Tue Sep 28, 2004 7:14 pm
Posts: 7
I found the issue. There was a bug in the refactored code. A Service object was getting added to the line items collection.

I will be so happy when Tiger gets here!


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

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.