From 39e913cbe2326d53498999ed3c4103992450c7db Mon Sep 17 00:00:00 2001 From: Robin Bygrave Date: Sat, 13 Feb 2016 12:30:31 +1300 Subject: [PATCH] #565 - Query plan hash collision on firstRow/maxRows combinations - change prime --- .../avaje/ebeaninternal/api/HashQueryPlanBuilder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/avaje/ebeaninternal/api/HashQueryPlanBuilder.java b/src/main/java/com/avaje/ebeaninternal/api/HashQueryPlanBuilder.java index 5a6e0f49e..ecbe059c1 100644 --- a/src/main/java/com/avaje/ebeaninternal/api/HashQueryPlanBuilder.java +++ b/src/main/java/com/avaje/ebeaninternal/api/HashQueryPlanBuilder.java @@ -12,7 +12,7 @@ public class HashQueryPlanBuilder { private String rawSql; public HashQueryPlanBuilder() { - this.planHash = 31; + this.planHash = 92821; } public String toString() { @@ -23,7 +23,7 @@ public class HashQueryPlanBuilder { * Add a class to the hash calculation. */ public HashQueryPlanBuilder add(Class cls) { - planHash = planHash * 31 + cls.getName().hashCode(); + planHash = planHash * 92821 + cls.getName().hashCode(); return this; } @@ -31,7 +31,7 @@ public class HashQueryPlanBuilder { * Add an object to the hash calculation. */ public HashQueryPlanBuilder add(Object object) { - planHash = planHash * 31 + (object == null ? 0 : object.hashCode()); + planHash = planHash * 92821 + (object == null ? 0 : object.hashCode()); return this; } @@ -39,7 +39,7 @@ public class HashQueryPlanBuilder { * Add an integer to the hash calculation. */ public HashQueryPlanBuilder add(int hashValue) { - planHash = planHash * 31 + (hashValue); + planHash = planHash * 92821 + (hashValue); return this; } @@ -47,7 +47,7 @@ public class HashQueryPlanBuilder { * Add a boolean to the hash calculation. */ public HashQueryPlanBuilder add(boolean booleanValue) { - planHash = planHash * 31 + (booleanValue ? 31 : 0); + planHash = planHash * 92821 + (booleanValue ? 92821 : 0); return this; }