Possible Party Relationship Problem?

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

Possible Party Relationship Problem?

samhamilton
Hi Guys,

I was trying to work out how to create a relationship between a user and
a company but I am getting an error - I am not a 100% sure if its my
error in selecting the wrong stuff or if its a bug so a little bit of
help would be great!

First go to this page -
https://demo.ofbiz.org/partymgr/control/EditPartyRelationships?partyId=DemoCustAgent
then in the "Add other party relationship" select
- in the role of = Sales Representative
- is A = Employee
- From Party ID = DemoCustCompany
- in the role of = Manufacturer
everything should be blank and then click Submit

I get the following error:
ERROR: Could not complete the createPartyRelationship
[file:/demo/deployments/demo-20091217-0306/applications/party/script/org/ofbiz/party/party/PartyServices.xml#createPartyRelationship]
process [problem creating the newEntity value: Error while inserting:
[GenericEntity:PartyRelationship][comments,null()][createdStamp,2009-12-17
12:56:36.512(java.sql.Timestamp)][createdTxStamp,2009-12-17
12:56:36.343(java.sql.Timestamp)][fromDate,2009-12-17
12:56:36.493(java.sql.Timestamp)][lastUpdatedStamp,2009-12-17
12:56:36.512(java.sql.Timestamp)][lastUpdatedTxStamp,2009-12-17
12:56:36.343(java.sql.Timestamp)][partyIdFrom,DemoCustCompany(java.lang.String)][partyIdTo,DemoCustAgent(java.lang.String)][partyRelationshipTypeId,EMPLOYMENT(java.lang.String)][roleTypeIdFrom,MANUFACTURER(java.lang.String)][roleTypeIdTo,SALES_REP(java.lang.String)][statusId,null()][thruDate,null()]
(SQL Exception while executing the following:INSERT INTO
OFBIZ.PARTY_RELATIONSHIP (PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM,
ROLE_TYPE_ID_TO, FROM_DATE, THRU_DATE, STATUS_ID, RELATIONSHIP_NAME,
SECURITY_GROUP_ID, PRIORITY_TYPE_ID, PARTY_RELATIONSHIP_TYPE_ID,
PERMISSIONS_ENUM_ID, POSITION_TITLE, COMMENTS, LAST_UPDATED_STAMP,
LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table
'PARTY_RELATIONSHIP' caused a violation of foreign key constraint
'PARTY_REL_FPROLE' for key (DemoCustCompany,MANUFACTURER). The statement
has been rolled back.))]

There are no required fields on that part of the page - the only thing
that is odd is that the drop down box for status does not have any content?

Sorry if this is me being stupid!

Cheers
Sam
Reply | Threaded
Open this post in threaded view
|

Re: Possible Party Relationship Problem?

David E. Jones-2

Basically it means that the from party is not in the role that you've specified.

The original idea with party roles in OFBiz was to not accidentally add parties to roles when a party in a role is referred to somewhere.

I've thought a few times that maybe it's not the best idea to do so, and instead whenever a party is implied to be in a role if they are not already then they should be added automatically.

-David


On Dec 17, 2009, at 1:05 PM, Sam Hamilton wrote:

> Hi Guys,
>
> I was trying to work out how to create a relationship between a user and
> a company but I am getting an error - I am not a 100% sure if its my
> error in selecting the wrong stuff or if its a bug so a little bit of
> help would be great!
>
> First go to this page -
> https://demo.ofbiz.org/partymgr/control/EditPartyRelationships?partyId=DemoCustAgent
> then in the "Add other party relationship" select
> - in the role of = Sales Representative
> - is A = Employee
> - From Party ID = DemoCustCompany
> - in the role of = Manufacturer
> everything should be blank and then click Submit
>
> I get the following error:
> ERROR: Could not complete the createPartyRelationship
> [file:/demo/deployments/demo-20091217-0306/applications/party/script/org/ofbiz/party/party/PartyServices.xml#createPartyRelationship]
> process [problem creating the newEntity value: Error while inserting:
> [GenericEntity:PartyRelationship][comments,null()][createdStamp,2009-12-17
> 12:56:36.512(java.sql.Timestamp)][createdTxStamp,2009-12-17
> 12:56:36.343(java.sql.Timestamp)][fromDate,2009-12-17
> 12:56:36.493(java.sql.Timestamp)][lastUpdatedStamp,2009-12-17
> 12:56:36.512(java.sql.Timestamp)][lastUpdatedTxStamp,2009-12-17
> 12:56:36.343(java.sql.Timestamp)][partyIdFrom,DemoCustCompany(java.lang.String)][partyIdTo,DemoCustAgent(java.lang.String)][partyRelationshipTypeId,EMPLOYMENT(java.lang.String)][roleTypeIdFrom,MANUFACTURER(java.lang.String)][roleTypeIdTo,SALES_REP(java.lang.String)][statusId,null()][thruDate,null()]
> (SQL Exception while executing the following:INSERT INTO
> OFBIZ.PARTY_RELATIONSHIP (PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM,
> ROLE_TYPE_ID_TO, FROM_DATE, THRU_DATE, STATUS_ID, RELATIONSHIP_NAME,
> SECURITY_GROUP_ID, PRIORITY_TYPE_ID, PARTY_RELATIONSHIP_TYPE_ID,
> PERMISSIONS_ENUM_ID, POSITION_TITLE, COMMENTS, LAST_UPDATED_STAMP,
> LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?,
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table
> 'PARTY_RELATIONSHIP' caused a violation of foreign key constraint
> 'PARTY_REL_FPROLE' for key (DemoCustCompany,MANUFACTURER). The statement
> has been rolled back.))]
>
> There are no required fields on that part of the page - the only thing
> that is odd is that the drop down box for status does not have any content?
>
> Sorry if this is me being stupid!
>
> Cheers
> Sam

Reply | Threaded
Open this post in threaded view
|

Re: Possible Party Relationship Problem?

Scott Gray-2
On 18/12/2009, at 12:15 PM, David E Jones wrote:

>
> Basically it means that the from party is not in the role that  
> you've specified.
>
> The original idea with party roles in OFBiz was to not accidentally  
> add parties to roles when a party in a role is referred to somewhere.
>
> I've thought a few times that maybe it's not the best idea to do so,  
> and instead whenever a party is implied to be in a role if they are  
> not already then they should be added automatically.
If we did that (which I'm in favor of), what purpose would the  
PartyRole entity continue to serve?

Regards
Scott

>
> -David
>
>
> On Dec 17, 2009, at 1:05 PM, Sam Hamilton wrote:
>
>> Hi Guys,
>>
>> I was trying to work out how to create a relationship between a  
>> user and
>> a company but I am getting an error - I am not a 100% sure if its my
>> error in selecting the wrong stuff or if its a bug so a little bit of
>> help would be great!
>>
>> First go to this page -
>> https://demo.ofbiz.org/partymgr/control/EditPartyRelationships?partyId=DemoCustAgent
>> then in the "Add other party relationship" select
>> - in the role of = Sales Representative
>> - is A = Employee
>> - From Party ID = DemoCustCompany
>> - in the role of = Manufacturer
>> everything should be blank and then click Submit
>>
>> I get the following error:
>> ERROR: Could not complete the createPartyRelationship
>> [file:/demo/deployments/demo-20091217-0306/applications/party/
>> script/org/ofbiz/party/party/
>> PartyServices.xml#createPartyRelationship]
>> process [problem creating the newEntity value: Error while inserting:
>> [GenericEntity:PartyRelationship][comments,null()][createdStamp,
>> 2009-12-17
>> 12:56:36.512(java.sql.Timestamp)][createdTxStamp,2009-12-17
>> 12:56:36.343(java.sql.Timestamp)][fromDate,2009-12-17
>> 12:56:36.493(java.sql.Timestamp)][lastUpdatedStamp,2009-12-17
>> 12:56:36.512(java.sql.Timestamp)][lastUpdatedTxStamp,2009-12-17
>> 12:56:36.343(java.sql.Timestamp)]
>> [partyIdFrom,DemoCustCompany(java.lang.String)]
>> [partyIdTo,DemoCustAgent(java.lang.String)]
>> [partyRelationshipTypeId,EMPLOYMENT(java.lang.String)]
>> [roleTypeIdFrom,MANUFACTURER(java.lang.String)]
>> [roleTypeIdTo,SALES_REP(java.lang.String)][statusId,null()]
>> [thruDate,null()]
>> (SQL Exception while executing the following:INSERT INTO
>> OFBIZ.PARTY_RELATIONSHIP (PARTY_ID_FROM, PARTY_ID_TO,  
>> ROLE_TYPE_ID_FROM,
>> ROLE_TYPE_ID_TO, FROM_DATE, THRU_DATE, STATUS_ID, RELATIONSHIP_NAME,
>> SECURITY_GROUP_ID, PRIORITY_TYPE_ID, PARTY_RELATIONSHIP_TYPE_ID,
>> PERMISSIONS_ENUM_ID, POSITION_TITLE, COMMENTS, LAST_UPDATED_STAMP,
>> LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES  
>> (?, ?, ?,
>> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table
>> 'PARTY_RELATIONSHIP' caused a violation of foreign key constraint
>> 'PARTY_REL_FPROLE' for key (DemoCustCompany,MANUFACTURER). The  
>> statement
>> has been rolled back.))]
>>
>> There are no required fields on that part of the page - the only  
>> thing
>> that is odd is that the drop down box for status does not have any  
>> content?
>>
>> Sorry if this is me being stupid!
>>
>> Cheers
>> Sam
>


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Possible Party Relationship Problem?

David E. Jones-2

On Dec 17, 2009, at 5:34 PM, Scott Gray wrote:

> On 18/12/2009, at 12:15 PM, David E Jones wrote:
>
>>
>> Basically it means that the from party is not in the role that you've specified.
>>
>> The original idea with party roles in OFBiz was to not accidentally add parties to roles when a party in a role is referred to somewhere.
>>
>> I've thought a few times that maybe it's not the best idea to do so, and instead whenever a party is implied to be in a role if they are not already then they should be added automatically.
>
> If we did that (which I'm in favor of), what purpose would the PartyRole entity continue to serve?

That's a good question. It would still keep track of which party is in which role... but really that information shouldn't be used alone, ie it should only be used in the context of defining a party's relationship with something else.

-David

Reply | Threaded
Open this post in threaded view
|

Re: Possible Party Relationship Problem?

Scott Gray-2
On 18/12/2009, at 12:42 PM, David E Jones wrote:

>
> On Dec 17, 2009, at 5:34 PM, Scott Gray wrote:
>
>> On 18/12/2009, at 12:15 PM, David E Jones wrote:
>>
>>>
>>> Basically it means that the from party is not in the role that  
>>> you've specified.
>>>
>>> The original idea with party roles in OFBiz was to not  
>>> accidentally add parties to roles when a party in a role is  
>>> referred to somewhere.
>>>
>>> I've thought a few times that maybe it's not the best idea to do  
>>> so, and instead whenever a party is implied to be in a role if  
>>> they are not already then they should be added automatically.
>>
>> If we did that (which I'm in favor of), what purpose would the  
>> PartyRole entity continue to serve?
>
> That's a good question. It would still keep track of which party is  
> in which role... but really that information shouldn't be used  
> alone, ie it should only be used in the context of defining a  
> party's relationship with something else.
That's exactly my concern, I often worry that developers misunderstand  
the purpose of the PartyRole entity and that its existence may cause  
more harm than good.

Regards
Scott

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Possible Party Relationship Problem?

Jacques Le Roux
Administrator
Hi David, Scott,

I have commited a related work at r893961

Jacques

From: "Scott Gray" <[hidden email]>

> On 18/12/2009, at 12:42 PM, David E Jones wrote:
>
>>
>> On Dec 17, 2009, at 5:34 PM, Scott Gray wrote:
>>
>>> On 18/12/2009, at 12:15 PM, David E Jones wrote:
>>>
>>>>
>>>> Basically it means that the from party is not in the role that  
>>>> you've specified.
>>>>
>>>> The original idea with party roles in OFBiz was to not  
>>>> accidentally add parties to roles when a party in a role is  
>>>> referred to somewhere.
>>>>
>>>> I've thought a few times that maybe it's not the best idea to do  
>>>> so, and instead whenever a party is implied to be in a role if  
>>>> they are not already then they should be added automatically.
>>>
>>> If we did that (which I'm in favor of), what purpose would the  
>>> PartyRole entity continue to serve?
>>
>> That's a good question. It would still keep track of which party is  
>> in which role... but really that information shouldn't be used  
>> alone, ie it should only be used in the context of defining a  
>> party's relationship with something else.
>
> That's exactly my concern, I often worry that developers misunderstand  
> the purpose of the PartyRole entity and that its existence may cause  
> more harm than good.
>
> Regards
> Scott