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

@@ -21,7 +21,12 @@ public class TableJoinColumn {
private final boolean insertable;
private final boolean updateable;
/**
* Hash for including in a query plan
*/
private final int queryHash;
/**
* Create the pair.
*/
@@ -30,12 +35,23 @@ public class TableJoinColumn {
this.foreignDbColumn = InternString.intern(deploy.getForeignDbColumn());
this.insertable = deploy.isInsertable();
this.updateable = deploy.isUpdateable();
this.queryHash = hashOf(localDbColumn) * 31 + hashOf(foreignDbColumn);
}
private int hashOf(String value) {
return (value == null) ? 0 : value.hashCode();
}
public String toString() {
return localDbColumn+" = "+foreignDbColumn;
}
/**
* Return a hash for including in a query plan.
*/
public int queryHash() {
return queryHash;
}
/**
* Return the foreign database column name.