Yes indeed this is know reason and why we have use-indices-unique="false" by 
default for Derby datasources
see http://svn.apache.org/viewvc?view=revision&revision=544640

I have completed r544640 by adding an explicit comment about 
use-indices-unique="false" at r1099727

Jacques

From: "Leon2" <[email protected]>
I found the cause. It's because that Derby treats "null" as a normal value in
its unique indice implementation. If you create an unique index, derby will
set the unique constraint on whole combination of all index fields no matter
the value of one field is null or not.

e.g. table 'test' has two columns (a int not null, b int) with unique index
on (a, b), then value combination (1, null) can be inserted into table once
and only once.

Workaround:  set use-indices-unique="false" explicitly in entityengine.xml
for derby database.

to Jacques,

Not test it on Postgres yet, but I think Postgres should be ok since
Postgres doesn't allow nullable column in unique indice. That means (1,
null) can be inserted to test table twice without unique index violation in
previous example.


to adnane,

That's great. I need such detail document. I'm evaluating the feasibility to
migrate the mysql database to postgres. The most important reason is
Timestamp type of mysql does not support milliseconds. So, thank you in
advance ^^.  You can send it to 'sun.hao' at 'labwayit' dot 'com'.


--
View this message in context: http://ofbiz.135035.n4.nabble.com/Exception-occured-when-I-try-to-add-a-new-person-tp3494394p3497786.html Sent from the OFBiz - User mailing list archive at Nabble.com.


Reply via email to