You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Ruth Hoffman <rh...@mindspring.com> on 2006/07/12 20:24:10 UTC

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

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







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

Posted by Ruth Hoffman <rh...@mindspring.com>.
Thanks Fred.

Fred Forester wrote:

> Hi Ruth,
>
> Attached is the file I import right after importing our data.
>
> Fred
>
>
> David E. Jones wrote:
>
>>
>> This is a general problem with ID sequencing and not specific to the 
>> ContactMech or other related entities.
>>
>> It's something you always have to watch out for when putting in your 
>> own data with your own IDs. If you need to do this sort of thing (it 
>> does come up fairly often when migrating data), then once the import 
>> is done just change the relevant records in the SequenceValueItem 
>> entity so that the sequenced IDs won't collide.
>>
>> -David
>>
>>
>> Ruth Hoffman wrote:
>>
>>> Hi Si:
>>> Thanks, that is exactly the problem.
>>> So I wonder, shouldn't the PartyContactMechServices simple service 
>>> have better error checking for the first time it trys to get a 
>>> ContactMechId? It works on subsequent tries, with no problems.
>>>
>>> TIA
>>> Ruth
>>>
>>> Si Chen wrote:
>>>
>>>> Ruth,
>>>>
>>>> Try changing your IDs in your seed data to 9000 or something.  
>>>> Don't  use 10000 as seed data id value because the system will also 
>>>> try to  use it the first time it creates new data.  See if that 
>>>> helps--if not  let's dig a little deeper.
>>>>
>>>> Si
>>>>
>>>>
>>>> On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
>>>>
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>------------------------------------------------------------------------
>
><?xml version="1.0" encoding="UTF-8"?>
><entity-engine-xml>
>    <SequenceValueItem seqName="ContactMech" seqId="610000" lastUpdatedStamp="2006-02-23 14:58:46.341" lastUpdatedTxStamp="2006-02-23 14:58:46.307" createdStamp="2006-02-23 14:58:46.341" createdTxStamp="2006-02-23 14:58:46.307"/>
>    <SequenceValueItem seqName="EntitySyncRemove" seqId="110070" lastUpdatedStamp="2006-02-23 14:58:46.35" lastUpdatedTxStamp="2006-02-23 14:58:46.307" createdStamp="2006-02-23 14:58:46.35" createdTxStamp="2006-02-23 14:58:46.307"/>
>    <SequenceValueItem seqName="JobSandbox" seqId="110010" lastUpdatedStamp="2006-02-23 14:58:46.352" lastUpdatedTxStamp="2006-02-23 14:58:46.307" createdStamp="2006-02-23 14:58:46.352" createdTxStamp="2006-02-23 14:58:46.307"/>
>    <SequenceValueItem seqName="Party" seqId="610000" lastUpdatedStamp="2006-02-23 14:58:46.354" lastUpdatedTxStamp="2006-02-23 14:58:46.307" createdStamp="2006-02-23 14:58:46.354" createdTxStamp="2006-02-23 14:58:46.307"/>
>    <SequenceValueItem seqName="ServerHitBin" seqId="110090" lastUpdatedStamp="2006-02-23 14:58:46.356" lastUpdatedTxStamp="2006-02-23 14:58:46.307" createdStamp="2006-02-23 14:58:46.356" createdTxStamp="2006-02-23 14:58:46.307"/>
>    <SequenceValueItem seqName="Visit" seqId="110020" lastUpdatedStamp="2006-02-23 14:58:46.358" lastUpdatedTxStamp="2006-02-23 14:58:46.307" createdStamp="2006-02-23 14:58:46.358" createdTxStamp="2006-02-23 14:58:46.307"/>
>    <SequenceValueItem seqName="InventoryItem" seqId="610000" lastUpdatedStamp="2006-02-23 14:58:46.358" lastUpdatedTxStamp="2006-02-23 14:58:46.307" createdStamp="2006-02-23 14:58:46.358" createdTxStamp="2006-02-23 14:58:46.307"/>
></entity-engine-xml>
>  
>

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

Posted by Fred Forester <fo...@fredforester.org>.
Hi Ruth,

Attached is the file I import right after importing our data.

Fred


David E. Jones wrote:
> 
> This is a general problem with ID sequencing and not specific to the 
> ContactMech or other related entities.
> 
> It's something you always have to watch out for when putting in your own 
> data with your own IDs. If you need to do this sort of thing (it does 
> come up fairly often when migrating data), then once the import is done 
> just change the relevant records in the SequenceValueItem entity so that 
> the sequenced IDs won't collide.
> 
> -David
> 
> 
> Ruth Hoffman wrote:
> 
>> Hi Si:
>> Thanks, that is exactly the problem.
>> So I wonder, shouldn't the PartyContactMechServices simple service 
>> have better error checking for the first time it trys to get a 
>> ContactMechId? It works on subsequent tries, with no problems.
>>
>> TIA
>> Ruth
>>
>> Si Chen wrote:
>>
>>> Ruth,
>>>
>>> Try changing your IDs in your seed data to 9000 or something.  Don't  
>>> use 10000 as seed data id value because the system will also try to  
>>> use it the first time it creates new data.  See if that helps--if 
>>> not  let's dig a little deeper.
>>>
>>> Si
>>>
>>>
>>> On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
>>>
>>>> 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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>

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

Posted by Ruth Hoffman <rh...@mindspring.com>.
David:
Great. Now I get it.
Thanks again,
Ruth

David E. Jones wrote:

>
>
> Ruth Hoffman wrote:
>
>> Could you clarify one point for me, please? If I had entered 4 
>> ContactMechId with values from 10000 to 10003, then would this error 
>> I saw happen for the first 4 attempts at creating a new 
>> ContactMechId? Or if I had picked, say 10010, this would have worked 
>> the first 9 times, failed the 10th time, and then worked after that?
>
>
> This is correct unless the system restarts during these processes, in 
> which case the current sequence banks are thrown out and it will jump 
> to the next multiple of 10.
>
> -David
>

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

Posted by "David E. Jones" <jo...@undersunconsulting.com>.

Ruth Hoffman wrote:
> Could you clarify one point for me, please? If I had entered 4 
> ContactMechId with values from 10000 to 10003, then would this error I 
> saw happen for the first 4 attempts at creating a new ContactMechId? Or 
> if I had picked, say 10010, this would have worked the first 9 times, 
> failed the 10th time, and then worked after that?

This is correct unless the system restarts during these processes, in which case the current sequence banks are thrown out and it will jump to the next multiple of 10.

-David


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

Posted by Ruth Hoffman <rh...@mindspring.com>.
Thanks David:
No issues at all with changing my data, As I said below, I ended up 
doing that once I figured out what the problem was.

Could you clarify one point for me, please? If I had entered 4 
ContactMechId with values from 10000 to 10003, then would this error I 
saw happen for the first 4 attempts at creating a new ContactMechId? Or 
if I had picked, say 10010, this would have worked the first 9 times, 
failed the 10th time, and then worked after that?

If the sequence generator works that way, then the error I saw makes 
complete sense to me.

TIA
Ruth

David E. Jones wrote:

>
> This is a general problem with ID sequencing and not specific to the 
> ContactMech or other related entities.
>
> It's something you always have to watch out for when putting in your 
> own data with your own IDs. If you need to do this sort of thing (it 
> does come up fairly often when migrating data), then once the import 
> is done just change the relevant records in the SequenceValueItem 
> entity so that the sequenced IDs won't collide.
>
> -David
>
>
> Ruth Hoffman wrote:
>
>> Hi Si:
>> Thanks, that is exactly the problem.
>> So I wonder, shouldn't the PartyContactMechServices simple service 
>> have better error checking for the first time it trys to get a 
>> ContactMechId? It works on subsequent tries, with no problems.
>>
>> TIA
>> Ruth
>>
>> Si Chen wrote:
>>
>>> Ruth,
>>>
>>> Try changing your IDs in your seed data to 9000 or something.  
>>> Don't  use 10000 as seed data id value because the system will also 
>>> try to  use it the first time it creates new data.  See if that 
>>> helps--if not  let's dig a little deeper.
>>>
>>> Si
>>>
>>>
>>> On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
>>>
>>>> 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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>

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

Posted by Andrew Sykes <an...@sykesdevelopment.com>.
Perhaps a "check after import" could fix this?

- Andrew

On Wed, 2006-07-12 at 15:02 -0500, Ruth Hoffman wrote:
> Hi Chris:
> That would be a nice feature, but it seems no matter how generous the 
> service is, there will always be the case where it will fail. In my 
> situation, a better understanding of how entities are sequenced would 
> have helped, since I picked 10000 because it seemed any number well over 
> 9000 was a good starting place. I didn't want to collide with the other 
> seed data. It never occurred to me (in my ignorance & bliss) that 
> collisions could happen at runtime.
> 
> Ruth
> Chris Howe wrote:
> 
> >Would it be worthwhile to improve the service that
> >gets the sequenceId to continue counting until it
> >finds a valid Id? As it is it gets the bank of 10 and
> >tries the first one and quits if it doesn't work.
> >
> >--- "David E. Jones" <jo...@undersunconsulting.com>
> >wrote:
> >
> >  
> >
> >>This is a general problem with ID sequencing and not
> >>specific to the ContactMech or other related
> >>entities.
> >>
> >>It's something you always have to watch out for when
> >>putting in your own data with your own IDs. If you
> >>need to do this sort of thing (it does come up
> >>fairly often when migrating data), then once the
> >>import is done just change the relevant records in
> >>the SequenceValueItem entity so that the sequenced
> >>IDs won't collide.
> >>
> >>-David
> >>
> >>
> >>Ruth Hoffman wrote:
> >>    
> >>
> >>>Hi Si:
> >>>Thanks, that is exactly the problem.
> >>>So I wonder, shouldn't the
> >>>      
> >>>
> >>PartyContactMechServices simple service have 
> >>    
> >>
> >>>better error checking for the first time it trys
> >>>      
> >>>
> >>to get a ContactMechId? 
> >>    
> >>
> >>>It works on subsequent tries, with no problems.
> >>>
> >>>TIA
> >>>Ruth
> >>>
> >>>Si Chen wrote:
> >>>
> >>>      
> >>>
> >>>>Ruth,
> >>>>
> >>>>Try changing your IDs in your seed data to 9000
> >>>>        
> >>>>
> >>or something.  Don't  
> >>    
> >>
> >>>>use 10000 as seed data id value because the
> >>>>        
> >>>>
> >>system will also try to  
> >>    
> >>
> >>>>use it the first time it creates new data.  See
> >>>>        
> >>>>
> >>if that helps--if not  
> >>    
> >>
> >>>>let's dig a little deeper.
> >>>>
> >>>>Si
> >>>>
> >>>>
> >>>>On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
> >>>>
> >>>>        
> >>>>
> >>>>>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
> >>>>>
> >>>>>          
> >>>>>
> >=== message truncated ===
> >
> >
> >  
> >
-- 
Kind Regards
Andrew Sykes <an...@sykesdevelopment.com>
Sykes Development Ltd
http://www.sykesdevelopment.com


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

Posted by Ruth Hoffman <rh...@mindspring.com>.
Hi Chris:
That would be a nice feature, but it seems no matter how generous the 
service is, there will always be the case where it will fail. In my 
situation, a better understanding of how entities are sequenced would 
have helped, since I picked 10000 because it seemed any number well over 
9000 was a good starting place. I didn't want to collide with the other 
seed data. It never occurred to me (in my ignorance & bliss) that 
collisions could happen at runtime.

Ruth
Chris Howe wrote:

>Would it be worthwhile to improve the service that
>gets the sequenceId to continue counting until it
>finds a valid Id? As it is it gets the bank of 10 and
>tries the first one and quits if it doesn't work.
>
>--- "David E. Jones" <jo...@undersunconsulting.com>
>wrote:
>
>  
>
>>This is a general problem with ID sequencing and not
>>specific to the ContactMech or other related
>>entities.
>>
>>It's something you always have to watch out for when
>>putting in your own data with your own IDs. If you
>>need to do this sort of thing (it does come up
>>fairly often when migrating data), then once the
>>import is done just change the relevant records in
>>the SequenceValueItem entity so that the sequenced
>>IDs won't collide.
>>
>>-David
>>
>>
>>Ruth Hoffman wrote:
>>    
>>
>>>Hi Si:
>>>Thanks, that is exactly the problem.
>>>So I wonder, shouldn't the
>>>      
>>>
>>PartyContactMechServices simple service have 
>>    
>>
>>>better error checking for the first time it trys
>>>      
>>>
>>to get a ContactMechId? 
>>    
>>
>>>It works on subsequent tries, with no problems.
>>>
>>>TIA
>>>Ruth
>>>
>>>Si Chen wrote:
>>>
>>>      
>>>
>>>>Ruth,
>>>>
>>>>Try changing your IDs in your seed data to 9000
>>>>        
>>>>
>>or something.  Don't  
>>    
>>
>>>>use 10000 as seed data id value because the
>>>>        
>>>>
>>system will also try to  
>>    
>>
>>>>use it the first time it creates new data.  See
>>>>        
>>>>
>>if that helps--if not  
>>    
>>
>>>>let's dig a little deeper.
>>>>
>>>>Si
>>>>
>>>>
>>>>On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
>>>>
>>>>        
>>>>
>>>>>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
>>>>>
>>>>>          
>>>>>
>=== message truncated ===
>
>
>  
>

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

Posted by Chris Howe <cj...@yahoo.com>.
Would it be worthwhile to improve the service that
gets the sequenceId to continue counting until it
finds a valid Id? As it is it gets the bank of 10 and
tries the first one and quits if it doesn't work.

--- "David E. Jones" <jo...@undersunconsulting.com>
wrote:

> 
> This is a general problem with ID sequencing and not
> specific to the ContactMech or other related
> entities.
> 
> It's something you always have to watch out for when
> putting in your own data with your own IDs. If you
> need to do this sort of thing (it does come up
> fairly often when migrating data), then once the
> import is done just change the relevant records in
> the SequenceValueItem entity so that the sequenced
> IDs won't collide.
> 
> -David
> 
> 
> Ruth Hoffman wrote:
> > Hi Si:
> > Thanks, that is exactly the problem.
> > So I wonder, shouldn't the
> PartyContactMechServices simple service have 
> > better error checking for the first time it trys
> to get a ContactMechId? 
> > It works on subsequent tries, with no problems.
> > 
> > TIA
> > Ruth
> > 
> > Si Chen wrote:
> > 
> >> Ruth,
> >>
> >> Try changing your IDs in your seed data to 9000
> or something.  Don't  
> >> use 10000 as seed data id value because the
> system will also try to  
> >> use it the first time it creates new data.  See
> if that helps--if not  
> >> let's dig a little deeper.
> >>
> >> Si
> >>
> >>
> >> On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
> >>
> >>> 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
> >>>
> 
=== message truncated ===


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

Posted by "David E. Jones" <jo...@undersunconsulting.com>.
This is a general problem with ID sequencing and not specific to the ContactMech or other related entities.

It's something you always have to watch out for when putting in your own data with your own IDs. If you need to do this sort of thing (it does come up fairly often when migrating data), then once the import is done just change the relevant records in the SequenceValueItem entity so that the sequenced IDs won't collide.

-David


Ruth Hoffman wrote:
> Hi Si:
> Thanks, that is exactly the problem.
> So I wonder, shouldn't the PartyContactMechServices simple service have 
> better error checking for the first time it trys to get a ContactMechId? 
> It works on subsequent tries, with no problems.
> 
> TIA
> Ruth
> 
> Si Chen wrote:
> 
>> Ruth,
>>
>> Try changing your IDs in your seed data to 9000 or something.  Don't  
>> use 10000 as seed data id value because the system will also try to  
>> use it the first time it creates new data.  See if that helps--if not  
>> let's dig a little deeper.
>>
>> Si
>>
>>
>> On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
>>
>>> 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
>>>
>>>
>>>
>>>
>>>
>>
>>

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

Posted by Ruth Hoffman <rh...@mindspring.com>.
Hi Si:
Thanks, that is exactly the problem.
So I wonder, shouldn't the PartyContactMechServices simple service have 
better error checking for the first time it trys to get a ContactMechId? 
It works on subsequent tries, with no problems.

TIA
Ruth

Si Chen wrote:

> Ruth,
>
> Try changing your IDs in your seed data to 9000 or something.  Don't  
> use 10000 as seed data id value because the system will also try to  
> use it the first time it creates new data.  See if that helps--if not  
> let's dig a little deeper.
>
> Si
>
>
> On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:
>
>> 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
>>
>>
>>
>>
>>
>
>

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

Posted by Si Chen <si...@opensourcestrategies.com>.
Ruth,

Try changing your IDs in your seed data to 9000 or something.  Don't  
use 10000 as seed data id value because the system will also try to  
use it the first time it creates new data.  See if that helps--if not  
let's dig a little deeper.

Si


On Jul 12, 2006, at 11:24 AM, Ruth Hoffman wrote:

> 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
>
>
>
>
>