[ 
http://jira.undersunconsulting.com/browse/OFBIZ-466?page=comments#action_13951 ]
     
Marco Risaliti commented on OFBIZ-466:
--------------------------------------

Hi Si & David, 

did you know if this issue is still open or we can close it ?

Thanks
Marco

> Alternative delegators do not work - entity engine refers back to "default"
> ---------------------------------------------------------------------------
>
>          Key: OFBIZ-466
>          URL: http://jira.undersunconsulting.com/browse/OFBIZ-466
>      Project: [OFBiz] Open For Business
>         Type: Bug
>   Components: entity
>     Versions: SVN
>     Reporter: Si Chen
>     Assignee: Jira Administrator
>      Fix For: SVN

>
>
> Creating GenericValues using alternative delegators does not work IF those 
> GenericValues are of entities not defined in the "default" delegator.  This 
> is because the entity engine keeps referring back to "default" to look for 
> entity meta definition.
> For example, in GenericDelegator.makeValue(entityName, fields) -
>         GenericValue value = GenericValue.create(entity, fields);
>         value.setDelegator(this);
> GenericValue is created without passing in a delegator first.  So how does it 
> know which delegator to use?  GenericEntity.getDelegator() forces a default -
> if (delegatorName == null) delegatorName = "default";
> We've had similar issues when trying to .create(...) or .createOrStore(...)  
> The entity engine needs a GenericPK, which it also looks for from the 
> "default" delegator.
> One work around we found was to create GenericValues this way--
> GenericDelegator altDelegator = GenericDelegator.getGenericDelegator("<alt 
> delegator>");
> EntityReader altReader = altDelegator.getModelReader();
> ModelEntity modelEntity = reader.getModelEntity("<entityName>");
> GenericValue newVal = GenericValue.create(modelEntity);
> newVal.setDelegator(altDelegator);
> newVal.putAll(<Map of values>);
> This can fix the GenericDelegator.makeValue(...) methods, but unfortunately 
> the resulting GenericValue still cannot be stored.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.undersunconsulting.com/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to