From 77b959f5cc881946832543d3894a560804d54fca Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Mon, 1 Jun 2009 22:08:28 +0000 Subject: [PATCH] HHH-3383 - QueryKey is storing references to entities instead of identifiers git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16660 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../java/org/hibernate/cache/QueryKey.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/org/hibernate/cache/QueryKey.java b/core/src/main/java/org/hibernate/cache/QueryKey.java index 33046edd45..a50adf8f09 100644 --- a/core/src/main/java/org/hibernate/cache/QueryKey.java +++ b/core/src/main/java/org/hibernate/cache/QueryKey.java @@ -91,19 +91,25 @@ public class QueryKey implements Serializable { } // disassemble named parameters - Map namedParameters = CollectionHelper.mapOfSize( queryParameters.getNamedParameters().size() ); - Iterator itr = queryParameters.getNamedParameters().entrySet().iterator(); - while ( itr.hasNext() ) { - final Map.Entry namedParameterEntry = ( Map.Entry ) itr.next(); - final TypedValue original = ( TypedValue ) namedParameterEntry.getValue(); - namedParameters.put( - namedParameterEntry.getKey(), - new TypedValue( - original.getType(), - original.getType().disassemble( original.getValue(), session, null ), - session.getEntityMode() - ) - ); + final Map namedParameters; + if ( queryParameters.getNamedParameters() == null ) { + namedParameters = null; + } + else { + namedParameters = CollectionHelper.mapOfSize( queryParameters.getNamedParameters().size() ); + Iterator itr = queryParameters.getNamedParameters().entrySet().iterator(); + while ( itr.hasNext() ) { + final Map.Entry namedParameterEntry = ( Map.Entry ) itr.next(); + final TypedValue original = ( TypedValue ) namedParameterEntry.getValue(); + namedParameters.put( + namedParameterEntry.getKey(), + new TypedValue( + original.getType(), + original.getType().disassemble( original.getValue(), session, null ), + session.getEntityMode() + ) + ); + } } // decode row selection...