Why are you using the userLoginId as a partyId?

By the way, there is no sleep function. There shouldn't be any need for one. The issue you are having is not related to timing.

-Adrian

Patrick wrote:
(INSERT on table 'PARTY_ROLE' caused a violation of foreign key
constraint 'PARTY_RLE_PARTY' for key (person48).

Error: ERROR: Could not complete the Create Party Role
[file:/opt/ofbiz-release9.04/applications/party/script/org/ofbiz/party/party/PartyServices.xml#createPartyRole]
process [problem creating the newEntity value: Error while inserting:
[GenericEntity:PartyRole][createdStamp,2010-02-01
15:40:58.095(java.sql.Timestamp)][createdTxStamp,2010-02-01
15:40:57.541(java.sql.Timestamp)][lastUpdatedStamp,2010-02-01
15:40:58.095(java.sql.Timestamp)][lastUpdatedTxStamp,2010-02-01
15:40:57.541(java.sql.Timestamp)][partyId,person48(java.lang.String)][roleTypeId,VENDOR(java.lang.String)]
(SQL Exception while executing the following:INSERT INTO
OFBIZ.PARTY_ROLE (PARTY_ID, ROLE_TYPE_ID, LAST_UPDATED_STAMP,
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?,
?, ?, ?, ?) (INSERT on table 'PARTY_ROLE' caused a violation of
foreign key constraint 'PARTY_RLE_PARTY' for key (person48). The
statement has been rolled back.))]   calling service createPartyRole
in createUserLoginAndCategory

This is the calling code.  It happens after I create the user.

<make-value value-field="partyRole" entity-name="PartyRole"/>
<set field="partyRole.partyId" value="${parameters.userLoginId}"/>
<set field="partyRole.roleTypeId" value="VENDOR"/>
<set-service-fields to-map="contextMap2"
service-name="createPartyRole" map="partyRole"/>
<call-service service-name="createPartyRole" in-map-name="contextMap2"/>







On Mon, Feb 1, 2010 at 3:35 PM, Cimballi <[email protected]> wrote:
The createPartyRole service doesn't require a Person, only a Party and
a RoleType.
Are you sure you understand well the error message ? Maybe you can copy it here.

Cimballi


On Mon, Feb 1, 2010 at 4:14 PM, Patrick <[email protected]> wrote:
In a simple-method, I create a user and give that user a "vendor" role
with the createUserLogin and createPartyRole services.

I can 1) create a user  and 2) give a user the role of "vendor".  The
problem is I can't  create a user and give THAT user a vendor role in
a single method.

When I try, createPartyRole complains that the target "Person" doesn't
exist, because it has a foreign key constraint.  So I think the
createUserLogin hasn't completed.  So I need some kind of <sleep>
until the createUserLogin is done.  What do you suggest?

Thanks for all your help so far.  Patrick


Reply via email to