diff --git a/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/util/Hibernate.java b/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/util/Hibernate.java index 566b82eda..a7add4506 100644 --- a/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/util/Hibernate.java +++ b/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/util/Hibernate.java @@ -40,17 +40,22 @@ public class Hibernate { public final static Class EnversSortedSet = loadHibernateEnversType("org.hibernate.envers.entities.mapper.relation.lazy.proxy.SortedSetProxy"); private static Class loadHibernateType(final String name) { - Class type = null; + Class result = tryToLoadClass(name); + if( result == null ){ + result = tryToLoadClass(name.replaceFirst("\\.internal\\.", ".")); + } + if( result == null){ + result = tryToLoadClass(name.replaceFirst("\\.internal\\.", ".spi.")); + } + return result; + } + + private static Class tryToLoadClass(String name) { try { - try { - type = HibernateProxy.class.getClassLoader().loadClass(name); - } catch (final ClassNotFoundException e) { - type = HibernateProxy.class.getClassLoader().loadClass(name.replaceFirst("\\.internal\\.", ".")); - } + return HibernateProxy.class.getClassLoader().loadClass(name); } catch (final ClassNotFoundException e) { - // not available + return null; } - return type; } private static Class loadHibernateEnversType(final String name) {