Fix for #227 - Many2Many cache bug, incorrect query plan hash calculation

This commit is contained in:
rbygrave committed 2015-01-11 20:45:07 +13:00
1 parent a998c0be55
commit 961b219e3e
3 files changed
+44 -4

No files matched your search

@@ -50,6 +50,11 @@ public final class TableJoin {
*/
private final TableJoinColumn[] columns;
/**
* A hash that can be used with the query plan.
*/
private final int queryHash;
/**
* Create a TableJoin.
*/
@@ -77,7 +82,26 @@ public final class TableJoin {
BeanProperty prop = propMap.get(deployProps[i].getName());
this.properties[i] = prop;
}
this.queryHash = calcQueryHash();
}
/**
* Calculate a hash value for adding to a query plan.
*/
private int calcQueryHash() {
int hc = type.hashCode();
hc = hc * 31 + (table == null ? 0 : table.hashCode());
for (int i = 0; i < columns.length; i++) {
hc = hc * 31 + columns[i].queryHash();
}
return hc;
}
/**
* Return a hash value for adding to a query plan.
*/
public int queryHash() {
return queryHash;
}
public String toString() {