Sending multiple emails simultaneously to new party does not work properly
--------------------------------------------------------------------------

                 Key: OFBIZ-3910
                 URL: https://issues.apache.org/jira/browse/OFBIZ-3910
             Project: OFBiz
          Issue Type: Bug
          Components: party
    Affects Versions: Release Branch 10.04
            Reporter: Martin Kreidenweis


Sending more than one email at once to a party that never has received an email 
using the sendMailFromScreen service fails. 
Creating the communication event for the email in this case triggers the 
createPartyRole service. So two threads apparently try to insert the same party 
role. This results in the following error: 
{code}
java.lang.Exception: Failure in create operation for entity [PartyRole]: 
org.ofbiz.entity.GenericEntityException: Error while inserting: 
[GenericEntity:PartyRole][createdStamp,2010-08-30 
10:44:41.144(java.sql.Timestamp)][createdTxStamp,2010-08-30 
10:44:26.709(java.sql.Timestamp)][lastUpdatedStamp,2010-08-30 
10:44:41.144(java.sql.Timestamp)][lastUpdatedTxStamp,2010-08-30 
10:44:26.709(java.sql.Timestamp)][partyId,RegisteredMerchantCompany(java.lang.String)][roleTypeId,ADDRESSEE(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 (?, ?, ?, ?, ?, ?) (ERROR: duplicate 
key value violates unique constraint »pk_party_role«)). Rolling back 
transaction.
{code}

This happens only after the actual emails are sent. OFBiz now rolls back the 
transaction, thinks the email sending failed, and tries to send the emails 
again later. 

Workaround: 
Create a PartyRole ADDRESSE for the party before trying to send emails. 
We did not find a good solution for the actual problem. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to