[JIRA] Closed: (OFBIZ-466) Alternative delegators do not work - entity engine refers back to "default"

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

[JIRA] Closed: (OFBIZ-466) Alternative delegators do not work - entity engine refers back to "default"

JIRA jira@ofbiz.org
     [ http://jira.undersunconsulting.com/browse/OFBIZ-466?page=all ]
     
Marco Risaliti closed OFBIZ-466:
--------------------------------

     Resolution: Duplicate
    Fix Version:     (was: SVN)

replaced by https://issues.apache.org/jira/browse/OFBIZ-299

> 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

>
>
> 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