-->
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: Referential Integrity with Stored Procedures
PostPosted: Wed Sep 01, 2010 8:25 pm 
Newbie

Joined: Sun Apr 18, 2010 11:56 pm
Posts: 5
I have 2 views mapped in hibernate to classes,
view A has a foreign key reference to view B

To manage the underlying tables I have stored procedures defined for sql-insert, sql-update, and sql-delete on both class definitions for the views.

When I try to delete a row in view B, hibernate automatically is generating:
update A set f_key_B=null where f_key_b={id for view B}

This causes an exception because view A is not updateable. If I could get hibernate to just not issue the update as it tries to maintain referential integrity, I could do this myself as a trigger in the database after the delete on view B.

Is there anyway to configure Hibernate to either:
(A) let me handle this in the database (with triggers),
or
(B) force hibernate to call another stored procedure to maintain referential integrity? The problem with this option is that there are many foreign keys in the database, that would each need a stored procedure (for example if view A also has a foreign key to view or table C)


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.