-->
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: Problem when deleting referenced objects
PostPosted: Wed Jul 26, 2006 5:32 pm 
Newbie

Joined: Wed Jul 26, 2006 4:45 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1.3

Mapping documents: Order Customer

Code between sessionFactory.openSession() and session.close():
Customer

Full stack trace of any exception that occurs:Exception

Hi my problem is: I have orders that belong to a customer. If I delete a customer, but an order exists, that belongs to that customer I get this exception. Is there any way to tell hibernate to delete these accosiations that point to data that doesn't exists anymore?

thank you for your help

greetings


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 12:22 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Your options are to do it in business logic (or in some layer between business logic and DAL), or to add the collection of Orders to your Customer class and mapping. Then you could add a cascade="delete" or some superset to the collection.

_________________
Code tags are your friend. Know them and use them.


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.