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" <[EMAIL PROTECTED]>
> >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 <[EMAIL PROTECTED]>
Sykes Development Ltd
http://www.sykesdevelopment.com