-
1. Re: Foreign key set to NULL
mbarragan Mar 8, 2004 2:35 PM (in response to benzam)I have the same problem...
I am running jboss-3.2.2RC3.
any idea????? -
2. Re: Foreign key set to NULL
jbm May 31, 2004 4:56 AM (in response to benzam)Please, if one of you had an answer since, could you post it ?
Thanks -
3. Re: Foreign key set to NULL
aloubyansky May 31, 2004 5:04 AM (in response to benzam)This is the intended behaviour. If a referenced entity can't be removed you have to check references yourself.
-
4. Re: Foreign key set to NULL
jbm May 31, 2004 6:11 AM (in response to benzam)Hi,
Thanks for your answer.
It's quite interresting behaviour.
I'd like to understand a bit farther, is there any doc where this behaviour is detailed ?
Or is there a simple and specific reason for it ?
Thanks.
Jbm -
5. Re: Foreign key set to NULL
aloubyansky May 31, 2004 8:11 AM (in response to benzam)A simple reason is to be able to remove w/o exception from the db.
As for me, there is no strict theoretical prove which way is right here. The default behaviour should the one that is expected in the majority of cases. -
6. Re: Foreign key set to NULL
hbaxmann May 31, 2004 11:23 AM (in response to benzam)It is a question of cardinality of the relationship _end_. Set a NOT NULL constraint on the FK will give you the exception. The full cardinality of the relation will then be: (Entity A)1:1 <--is a--> 1:1(Entity B) which means: "one and exactly one is A one and exactly one B" in contrast to "one or no A is one or no B": 0:1<--is a-->0:1.
JBoss has obviously in your case the 0 as default for the lower boundary of relationship ends. But this should come from the NOT NULL attribute of DatabaseMetadata.
bax