Unique constraint on [Person].[cardId] breaks ofbiz on SQL Server

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unique constraint on [Person].[cardId] breaks ofbiz on SQL Server

pprice
There is a unique constraint placed on the [cardId] column of the PERSON table and it is causing (at least, it's the first of hundreds of errors) the demo data to fail to load. I believe there is something more fundamentally wrong with this constraint in SQL Server however, as when I tried to install ofbiz with only seed data and then perform the setup steps at http://<server>/ofbizsetup, I was unable to complete the initial setup due to the same constraint being violated.

My environment:
MS SQL Server 2008
sqljdbc4 drivers

Steps to reproduce:
Start with download of ofbiz-13.07.01
Followed the MS SQL setup steps in the entityengine.xml file
./ant build
./ant load-demo

First error from logs is below:
[java] 20141016110019633 |main                 |GenericDelegator    |E| Failure in create operation for entity [Person]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:Person
][createdStamp,2014-10-16 11:00:19.628(java.sql.Timestamp)][createdTxStamp,2014-10-16 11:00:19.623(java.sql.Timestamp)][lastUpdatedStamp,2014-10-16 11:00:19.628(java.sql.Timestamp)][lastUpdatedTxStamp,2014-10-16
 11:00:19.623(java.sql.Timestamp)][partyId,_NA_(java.lang.String)] (SQL Exception while executing the following:INSERT INTO dbo.PERSON (PARTY_ID, SALUTATION, FIRST_NAME, MIDDLE_NAME, LAST_NAME, PERSONAL_TITLE, S
UFFIX, NICKNAME, FIRST_NAME_LOCAL, MIDDLE_NAME_LOCAL, LAST_NAME_LOCAL, OTHER_LOCAL, MEMBER_ID, GENDER, BIRTH_DATE, DECEASED_DATE, HEIGHT, WEIGHT, MOTHERS_MAIDEN_NAME, MARITAL_STATUS, SOCIAL_SECURITY_NUMBER, PASS
PORT_NUMBER, PASSPORT_EXPIRE_DATE, TOTAL_YEARS_WORK_EXPERIENCE, COMMENTS, EMPLOYMENT_STATUS_ENUM_ID, RESIDENCE_STATUS_ENUM_ID, OCCUPATION, YEARS_WITH_EMPLOYER, MONTHS_WITH_EMPLOYER, EXISTING_CUSTOMER, CARD_ID, L
AST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Cannot insert dupli
cate key row in object 'dbo.PERSON' with unique index 'CARD_ID_IDX'. The duplicate key value is (<NULL>).)). Rolling back transaction.
Reply | Threaded
Open this post in threaded view
|

Re: Unique constraint on [Person].[cardId] breaks ofbiz on SQL Server

pprice
Even disabling this constraint there are still hundreds of other errors. OFBiz appears to be un-usable on SQL Server
Reply | Threaded
Open this post in threaded view
|

Re: Unique constraint on [Person].[cardId] breaks ofbiz on SQL Server

pprice
While trying to understand how the demo data was able to work in the derby database I found this comment in the entityengine.xml
<!-- beware use-indices-unique="false" is needed because of Derby bug with null values in a unique index -->

Adding this setting to the localmssql config appears to work around the issue, though has the side effect of disabling all unique constraints.
use-indices-unique="false"