You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Deepak Dixit (JIRA)" <ji...@apache.org> on 2014/05/05 14:38:16 UTC

[jira] [Commented] (OFBIZ-5199) Complex Alias is not working with default value.

    [ https://issues.apache.org/jira/browse/OFBIZ-5199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13989466#comment-13989466 ] 

Deepak Dixit commented on OFBIZ-5199:
-------------------------------------

Hi Jacopo,

Here is the code snippet to regenerate error:

{code}
import org.ofbiz.entity.model.DynamicViewEntity;
import org.ofbiz.entity.model.ModelKeyMap;
import org.ofbiz.entity.model.ModelViewEntity.ComplexAlias;
import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasField;
import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasMember;


ComplexAlias eddComplexAlias = new ComplexAlias("min");
eddComplexAlias.addComplexAliasMember(new ComplexAliasField("OI", "estimatedDeliveryDate", nowTimestamp.toString(), "min"));

DynamicViewEntity dve = new DynamicViewEntity();
dve.addMemberEntity("OH", "OrderHeader");
dve.addAlias("OH", "orderId", null, null, null, Boolean.TRUE, null);
dve.addMemberEntity("OI", "OrderItem");
dve.addAlias("OI", "statusId", "statusId", null, null, Boolean.TRUE, null);
dve.addAlias(null, "estimatedDeliveryDate", null, null, null, null, null, eddComplexAlias);
dve.addViewLink("OH", "OI", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("orderId", "orderId")));

eli = delegator.findListIteratorByCondition(dve, null, null, null, null, null);
println("=========================" + eli.getCompleteList());

{code}


You will get following error:
{code}
 [java] com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '18:01:25.147)), SUM(OI.QUANTITY) FROM ORDER_HEADER OH INNER JOIN ORDER_ITEM OI O' at line 1
{code}


Apply the patch and re-run the code it should working fine.

> Complex Alias is not working with default value.
> ------------------------------------------------
>
>                 Key: OFBIZ-5199
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5199
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release 10.04, Release Branch 11.04, SVN trunk, Release Branch 12.04
>            Reporter: Deepak Dixit
>            Priority: Minor
>             Fix For: Release Branch 10.04, Release Branch 11.04, SVN trunk, Release Branch 12.04
>
>         Attachments: OFBIZ-5199-R.patch, OFBIZ-5199.patch
>
>
> If we pass the default value then complex alias is broken and throwing exception while executing the query.



--
This message was sent by Atlassian JIRA
(v6.2#6252)