wood burning stoves*
The moose likes JDBC and the fly likes Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Query" Watch "Query" New topic


amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
How to use foreign keys as they establish relation between parent and child table and also if any updation or deletion is done in parent table the child table is also done with the changes?

Please tell the query...

Thanks advance who ever answers this question.

amit bhadre
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703

I believe what you are interested in is 'cascading deletes'. When you create the table reference you add the keywords "ON DELETE CASCADE" without the quotes.

The syntax may very from db to db so you might have to check google for except specifications.

My Blog: Down Home Country Coding with Scott Selikoff
jQuery in Action, 2nd edition
subject: Query
Similar Threads
How does Hibernate get child objects
Can't remove (delete) rows in one to many relationship
Updation of child table.
auto insert/update/delete
i have a Errors in Hibernate Query