Is this a bug, or am I just setting up my seed data incorrectly?

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

Is this a bug, or am I just setting up my seed data incorrectly?

Ruth Hoffman
Hello All:
Not sure if this question is appropriate as a dev list (a bug?) or user
list ("operator error") question, so I'm posting to both.

I was wondering if someone out there, familiar with ContactMech and all
the related entities (as well as how the PartyContactMechServices.xml
simple method works), could shed some light on this for me (this
behavior was confirmed to exist in a release that I downloaded and built
yesterday):

If I create a ContactMech for the admin user like the following and load
it with the seed data:

*<ContactMech contactMechId="10000" contactMechTypeId="POSTAL_ADDRESS" />
<PartyContactMech partyId="admin" contactMechId="10000"
fromDate="2006-07-04 17:12:53.57" />
<PostalAddress contactMechId="10000" toName="Le Boss" attnName="Le
Biggest Boss" address1="No. 1 High Brow Lane"
            address2="On The Road to Nowhere" city="Valhalla"
postalCode="77888" countryGeoId="USA" stateProvinceGeoId="TX" />
<PartyContactMechPurpose partyId="admin" contactMechId="10000"
contactMechPurposeTypeId="SHIPPING_LOCATION" fromDate="2006-07-04
17:54:07.432" />
*
I get the following error  returned to the web page when I try to create
a new user (http:~/control/createcustomer):

*ERROR: Could not complete the Create Contact Mechanism
[file:/Users/ruthhoffman/ofbiz420914/applications/party/script/org/ofbiz/party/contact/ContactMechServices.xml#createContactMech]
process [problem creating the newValue value: Exception while inserting
the following entity:
[GenericEntity:ContactMech][contactMechId,10000(java.lang.String)][contactMechTypeId,POSTAL_ADDRESS(java.lang.String)][createdStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)][createdTxStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)][infoString,null()][lastUpdatedStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)][lastUpdatedTxStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)] (while inserting:
[GenericEntity:ContactMech][contactMechId,10000(java.lang.String)][contactMechTypeId,POSTAL_ADDRESS(java.lang.String)][createdStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)][createdTxStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)][infoString,null()][lastUpdatedStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)][lastUpdatedTxStamp,2006-07-12
12:49:56.313(java.sql.Timestamp)] (SQL Exception while executing the
following:INSERT INTO OFBIZ.CONTACT_MECH (CONTACT_MECH_ID,
CONTACT_MECH_TYPE_ID, INFO_STRING, LAST_UPDATED_STAMP,
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?,
?, ?, ?, ?) (The statement was aborted because it would have caused a
duplicate key value in a unique or primary key constraint or unique
index identified by 'SQL060712004036980' defined on 'CONTACT_MECH'.)))]
calling service createContactMech in createPostalAddress calling service
createPostalAddress in createPartyPostalAddress calling service
createPartyPostalAddress in createCustomer*

But the interesting thing is this only happens the first time I try to
create a new user. That is, it only happens the first time after I've
rebuilt & reloaded the seed data (with this addition.) All other,
subsequent attempts to create new users and add postal addresses work
fine. So, I'm wondering why it would fail at all, and also why just the
first time?

Another data point: if I change the seed data to look like this:

*<ContactMech contactMechId="ADMIN_ADDRESS"
contactMechTypeId="POSTAL_ADDRESS" />
<PartyContactMech partyId="admin" contactMechId="ADMIN_ADDRESS"
fromDate="2006-07-04 17:12:53.57" />
<PostalAddress contactMechId="ADMIN_ADDRESS" toName="Le Boss"
attnName="Le Biggest Boss" address1="No. 1 High Brow Lane"
            address2="On The Road to Nowhere" city="Valhalla"
postalCode="77888" countryGeoId="USA" stateProvinceGeoId="TX" />
<PartyContactMechPurpose partyId="admin" contactMechId="ADMIN_ADDRESS"
contactMechPurposeTypeId="SHIPPING_LOCATION" fromDate="2006-07-04
17:54:07.432" />*

Everything works as expected: a user is created and a postal address is
associated with the user, first time, everytime.

Of course, now that I understand what caused this problem, I've
corrected my seed data. But I'm still really curious as to why we
experienced the error condition with the original data.

Any insight is eagerly awaited.

TIA
Ruth