-->
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.  [ 5 posts ] 
Author Message
 Post subject: Delete values in another table
PostPosted: Thu Nov 24, 2005 3:42 pm 
Newbie

Joined: Thu Nov 24, 2005 3:31 pm
Posts: 6
Hi,

I've a table which holds the primary key(ACL_TABLE) of 5 other tables in one column. The 5 other tables don't have any foreign-key contraint with the ACL_TABLE table. Now, whenever a record in the 5 other tables is deleted, I want the corresponding record in this table deleted as well.

However, my application does not know when the 5 other table records are deleted. So, I can't delete the record in this table. I can't use CASCADE.DELETE as they are not bound by any relatiship.

I'm thinking of using Hibernate interceptor where onDelete of the record, I'll go and delete the record in the ACL_TABLE. However, after investigation, I found that you can't do this with interceptor as interceptor only allows you to work on the entity that is being deleted.

Is there any way I can solve this problem. I don't want to use Trigger(like Oracle trigger) as I would like to do this in the application.

Any suggestions will be appreciated.

thanks
-ron


Top
 Profile  
 
 Post subject: Re: Delete values in another table
PostPosted: Sat Nov 26, 2005 6:42 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:57 pm
Posts: 48
Location: Los Angeles, CA
rknr55 wrote:
However, after investigation, I found that you can't do this with interceptor as interceptor only allows you to work on the entity that is being deleted.


Why not? Why can't you run a delete query inside the onDelete() method?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 26, 2005 7:55 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
Why don't you use triggers? Doesn't your db support them!?

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject: Re: Delete values in another table
PostPosted: Wed Nov 30, 2005 10:30 am 
Newbie

Joined: Thu Nov 24, 2005 3:31 pm
Posts: 6
jd001982 wrote:
rknr55 wrote:
However, after investigation, I found that you can't do this with interceptor as interceptor only allows you to work on the entity that is being deleted.


Why not? Why can't you run a delete query inside the onDelete() method?


--No, I can delete it in onDelete only if I create a new temporary session.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 10:31 am 
Newbie

Joined: Thu Nov 24, 2005 3:31 pm
Posts: 6
pasha wrote:
Why don't you use triggers? Doesn't your db support them!?

--I don't want to use db triggers because the app I'm building is supposed to work with many databases and so most of the stuffs should be done within application


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.