Hi guys,
About issue:
I have next tables:
Code:
CREATE TABLE `const_streets` (
`street_id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`street_id`)
);
CREATE TABLE `adr_obj1` (
`adr_id` int(10) unsigned NOT NULL auto_increment,
`street_id` int(10) unsigned NOT NULL default '0',
`name` varchar(45) default NULL,
PRIMARY KEY (`adr_id`),
KEY `street_id_obj1` (`street_id`),
CONSTRAINT `street_id_obj1` FOREIGN KEY (`street_id`) REFERENCES `const_streets` (`street_id`) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE `adr_obj2` (
`adr_id` int(10) unsigned NOT NULL auto_increment,
`street_id` int(10) unsigned NOT NULL default '0',
`name` varchar(45) default NULL,
PRIMARY KEY (`adr_id`),
KEY `street_id_obj2` (`street_id`),
CONSTRAINT `street_id_obj2` FOREIGN KEY (`street_id`) REFERENCES `const_streets` (`street_id`) ON DELETE CASCADE ON UPDATE CASCADE
);
Each address table has a foreign key constraint to a STREET table.
I need to delete street. But when it is coupled to any address, DB constraint doesn't allow to do it. Hibernate wait for a long time, when throws an exception.
Is it possible to throw exception immediately?
There are possible a lot of address tables.
hibernate version 3.2.2, Java 5.0 and MySQL 5.0 are used.