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: Simple one-to-many mapping for deletion
PostPosted: Wed Mar 18, 2009 5:11 am 
Newbie

Joined: Thu Nov 30, 2006 11:05 am
Posts: 5
Hi,

We have 2 entities. ITEM and VARIABLE. An Item can have more than one-variable. The variables will be updated, which means, every time an item.setVariables(List<Variable>) is invoked and session.saveOrUpdate(item) is done, the old variables should be removed and the new ones be inserted.

The configuration we have works for Inserts, but it fails to delete the existing Variables.

We have the @OneToMany (CascadeType.ALL) defined on Item side and @OneToMany defined on Variable side, with the ITEM_ID primary key join column.

Is there any specific configuration to be provided ? Also, if someone can give the exact config and setup for this, it will be helpful.

Thanks,
Sriram


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 18, 2009 6:10 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
sriramn wrote:
@OneToMany defined on Variable side, with the ITEM_ID primary key join column.

On the Variable side it should be ManyToOne.

sriramn wrote:
Is there any specific configuration to be provided ?

No.

_________________
Regards,
Litty Preeth


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.