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

Manuel Blechschmidt commented on OLINGO-606:
--------------------------------------------

The problem is the following function:

{code:title=JPQLSelectContextView.java}
..
  /**
   * The method returns an ordered map of JPQL ORDERBY clause. The ORDERBY 
clause
   * is built from $orderby OData system query option. The hash map contains
   * <ol>
   * <li>Key - JPA Entity Property name to be ordered</li>
   * <li>Value - Sort Order in JPQL (desc,asc)</li>
   * </ol>
   * in the order based on the expression specified
   * (accessible with <code>Map.entrySet(..)</code>).
   * 
   * @return an ordered map of (JPA Property Name,Sort Order)
   */
  public Map<String, String> getOrderByCollection();
...
{code}

A map does not guarantee that the entrySet will always return the values in the 
same order like added. It is said in the documentation that the order is kept. 
It seems that this is only a problem in the mocking.

> Current master fails test cases because of sorting of join statements on JDK8
> -----------------------------------------------------------------------------
>
>                 Key: OLINGO-606
>                 URL: https://issues.apache.org/jira/browse/OLINGO-606
>             Project: Olingo
>          Issue Type: Bug
>         Environment: Mac OS X
> java version "1.8.0"
> Java(TM) SE Runtime Environment (build 1.8.0-b132)
> Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
>            Reporter: Manuel Blechschmidt
>              Labels: attributes, hashmap, jdk8, sorting
>
> {code}
> git clone https://github.com/apache/olingo-odata2
> cd olingo-odata2/odata2-jpa-processor/jpa-core
> mvn install
> ...
> Failed tests:   
> testBuild(org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinStatementBuilderTest):
>  expected:<... 'abc' ORDER BY mat.[buyerId asc , mat.city de]sc> but was:<... 
> 'abc' ORDER BY mat.[city desc , mat.buyerId a]sc>
> ...
> {code}
> With java 1.7 it works:
> {code}
> export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
> mvn install
> ...
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> ...
> {code}
> It is likely a hashmap which should be replaced with LinkedHashMap.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to