Skip to content

Commit

Permalink
HHH-5881 - Add getter for "namedParameters" to QueryKey
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed May 30, 2012
1 parent dddc959 commit c8431ce
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions hibernate-core/src/main/java/org/hibernate/cache/spi/QueryKey.java
Expand Up @@ -25,6 +25,7 @@


import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;


Expand Down Expand Up @@ -54,7 +55,7 @@ public class QueryKey implements Serializable {
private final String tenantIdentifier; private final String tenantIdentifier;
private final Set filterKeys; 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. // transformed/non-transformed results.
private final CacheableResultTransformer customTransformer; private final CacheableResultTransformer customTransformer;


Expand Down Expand Up @@ -174,10 +175,25 @@ public static QueryKey generateQueryKey(
this.hashCode = generateHashCode(); this.hashCode = generateHashCode();
} }


/**
* Provides access to the explicitly user-provided result transformer.
*
* @return The result transformer.
*/
public CacheableResultTransformer getResultTransformer() { public CacheableResultTransformer getResultTransformer() {
return customTransformer; 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. * Deserialization hook used to re-init the cached hashcode which is needed for proper clustering support.
* *
Expand Down Expand Up @@ -206,9 +222,6 @@ private int generateHashCode() {
return result; return result;
} }


/**
* {@inheritDoc}
*/
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
if ( !( other instanceof QueryKey ) ) { if ( !( other instanceof QueryKey ) ) {
Expand Down Expand Up @@ -251,17 +264,11 @@ public boolean equals(Object other) {
&& EqualsHelper.equals( tenantIdentifier, that.tenantIdentifier ); && EqualsHelper.equals( tenantIdentifier, that.tenantIdentifier );
} }


/**
* {@inheritDoc}
*/
@Override @Override
public int hashCode() { public int hashCode() {
return hashCode; return hashCode;
} }


/**
* {@inheritDoc}
*/
@Override @Override
public String toString() { public String toString() {
StringBuilder buffer = new StringBuilder( "sql: " ).append( sqlQueryString ); StringBuilder buffer = new StringBuilder( "sql: " ).append( sqlQueryString );
Expand Down

0 comments on commit c8431ce

Please sign in to comment.