[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2235?page=c...
]
Christian Bauer commented on HHH-2235:
--------------------------------------
Sure, most SQL DBMSs have broken NULL handling. When you INSERT a row, you might avoid
duplicates in Oracle because they treat NULL as some special value (they have other crazy
ideas about NULL, too).
But NULL is not a value, you not compare two NULLs and get a true/false answer, hence, you
can not determine uniqueness. So other DBMSs allow nullable columns in composite unique
constraints but just ignore NULLs during INSERT check (MySQL I think). In DBMSs it only
works as long as there is only a single row with a NULL value (SQL Server)!
You will get duplicate rows and that is exactly the reason why the SQL guys came up with
the notion of "primary key", which means a unique key that has no nullable
components. (That is, a "candidate key" as defined by the relational data model.
There are no NULLs in the relational data model.)
Support for null map-keys in <map> mappings
-------------------------------------------
Key: HHH-2235
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2235
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.0.ga
Reporter: Igor Lobanov
Priority: Minor
I'm not sure if I should file it as a bug.
Hibernate requires index column for <map> mappings to be not null. This is required
by the code in AbstractCollectionPersister#readIndex(...), which raises exception if index
column is null. However, when I override collection persister and force readIndex method
to return null, everything seems to work fine. Hibernate allows me to work with maps using
null value as a key. Though I havn't tested it extensivly yet.
What is the reason for disallowing null values as a keys? If there are possible
complicated error conditions, then this issue is a feature request for null-values support
for <map> mappings. If there are no errors possible, then constraining such behavior
is probably wrong.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira