From 381198c2065ada380360e59a1d72e9b18e8c0234 Mon Sep 17 00:00:00 2001 From: Scott Marlow Date: Thu, 17 Oct 2013 09:21:00 -0400 Subject: [PATCH] HHH-8477 use unwrapped query --- .../org/hibernate/jpa/internal/EntityManagerFactoryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java index 69e662a6fe..52ac30b809 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/EntityManagerFactoryImpl.java @@ -401,7 +401,7 @@ public class EntityManagerFactoryImpl implements HibernateEntityManagerFactory { final HibernateQuery unwrapped = query.unwrap( HibernateQuery.class ); if ( unwrapped != null ) { // create and register the proper NamedQueryDefinition... - final org.hibernate.Query hibernateQuery = ( (HibernateQuery) query ).getHibernateQuery(); + final org.hibernate.Query hibernateQuery = unwrapped.getHibernateQuery(); if ( org.hibernate.SQLQuery.class.isInstance( hibernateQuery ) ) { sessionFactory.registerNamedSQLQueryDefinition( name,