Permalink
Browse files

HHH-5881 - Add getter for "namedParameters" to QueryKey

  • Loading branch information...
1 parent dddc959 commit c8431ce5d9a55a2b9e76af5df4e5a1fd8d593be8 @sebersole sebersole committed May 30, 2012
Showing with 17 additions and 10 deletions.
  1. +17 −10 hibernate-core/src/main/java/org/hibernate/cache/spi/QueryKey.java
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.Serializable;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
@@ -54,7 +55,7 @@
private final String tenantIdentifier;
private final Set filterKeys;
- // the user provided resulttransformer, not the one used with "select new". Here to avoid mangling
+ // the explicit user-provided result transformer, not the one used with "select new". Here to avoid mangling
// transformed/non-transformed results.
private final CacheableResultTransformer customTransformer;
@@ -174,10 +175,25 @@ public static QueryKey generateQueryKey(
this.hashCode = generateHashCode();
}
+ /**
+ * Provides access to the explicitly user-provided result transformer.
+ *
+ * @return The result transformer.
+ */
public CacheableResultTransformer getResultTransformer() {
return customTransformer;
}
+ /**
+ * Provide (unmodifiable) access to the named parameters that are part of this query.
+ *
+ * @return The (unmodifiable) map of named parameters
+ */
+ @SuppressWarnings("unchecked")
+ public Map getNamedParameters() {
+ return Collections.unmodifiableMap( namedParameters );
+ }
+
/**
* Deserialization hook used to re-init the cached hashcode which is needed for proper clustering support.
*
@@ -206,9 +222,6 @@ private int generateHashCode() {
return result;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean equals(Object other) {
if ( !( other instanceof QueryKey ) ) {
@@ -251,17 +264,11 @@ public boolean equals(Object other) {
&& EqualsHelper.equals( tenantIdentifier, that.tenantIdentifier );
}
- /**
- * {@inheritDoc}
- */
@Override
public int hashCode() {
return hashCode;
}
- /**
- * {@inheritDoc}
- */
@Override
public String toString() {
StringBuilder buffer = new StringBuilder( "sql: " ).append( sqlQueryString );

0 comments on commit c8431ce

Please sign in to comment.