From efcc2577a608e944098c4aa727f4d4b0f5867585 Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Mon, 5 May 2008 20:52:29 +0000 Subject: [PATCH] OPENJPA-590 committing patch provided by Fay Wang git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@653595 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/kernel/exps/QueryExpressions.java | 5 +++-- .../apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java index ac357b5eb..087687baf 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java @@ -21,6 +21,7 @@ package org.apache.openjpa.kernel.exps; import java.io.Serializable; import java.util.Collections; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import org.apache.commons.collections.map.LinkedMap; @@ -47,7 +48,7 @@ public class QueryExpressions /** * Map of {@link FieldMetaData},{@link Value} for update statements. */ - public Map updates = Collections.EMPTY_MAP; + public Map updates = Collections.EMPTY_MAP; public int distinct = DISTINCT_AUTO; public String alias = null; public Value[] projections = EMPTY_VALUES; @@ -86,7 +87,7 @@ public class QueryExpressions */ public void putUpdate(Path path, Value val) { if (updates == Collections.EMPTY_MAP) - updates = new HashMap(); + updates = new LinkedHashMap(); updates.put(path, val); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java index 38b366145..a206f3b2f 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java @@ -26,6 +26,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.Set; import java.util.Stack; import java.util.TreeSet; @@ -1569,12 +1570,12 @@ public class JPQLExpressionBuilder } JPQLNode[] findChildrenByID(int id) { - Collection set = new HashSet(); + Collection set = new LinkedHashSet(); findChildrenByID(id, set); - return (JPQLNode[]) set.toArray(new JPQLNode[set.size()]); + return set.toArray(new JPQLNode[set.size()]); } - private void findChildrenByID(int id, Collection set) { + private void findChildrenByID(int id, Collection set) { for (int i = 0; children != null && i < children.length; i++) { if (children[i].id == id) set.add(children[i]);