|
1 | 1 | /* |
2 | | - * Copyright (C) 2012, 2013, 2014, 2018 XStream Committers. |
| 2 | + * Copyright (C) 2012, 2013, 2014, 2018, 2025 XStream Committers. |
3 | 3 | * All rights reserved. |
4 | 4 | * |
5 | 5 | * Created on 08.06.2012 by Joerg Schaible |
|
17 | 17 | */ |
18 | 18 | public class Hibernate { |
19 | 19 | /** <code>PersistentBag</code> contains Hibernate's PersistenBag class type. */ |
20 | | - public final static Class<?> PersistentBag = loadHibernateType("org.hibernate.collection.internal.PersistentBag"); |
| 20 | + public final static Class<?> PersistentBag = loadHibernateType("org.hibernate.collection.spi.PersistentBag"); |
21 | 21 | /** <code>PersistentList</code> contains Hibernate's PersistenList class type. */ |
22 | | - public final static Class<?> PersistentList = loadHibernateType("org.hibernate.collection.internal.PersistentList"); |
| 22 | + public final static Class<?> PersistentList = loadHibernateType("org.hibernate.collection.spi.PersistentList"); |
23 | 23 | /** <code>PersistentMap</code> contains Hibernate's PersistenMap class type. */ |
24 | | - public final static Class<?> PersistentMap = loadHibernateType("org.hibernate.collection.internal.PersistentMap"); |
| 24 | + public final static Class<?> PersistentMap = loadHibernateType("org.hibernate.collection.spi.PersistentMap"); |
25 | 25 | /** <code>PersistentSet</code> contains Hibernate's PersistenSet class type. */ |
26 | | - public final static Class<?> PersistentSet = loadHibernateType("org.hibernate.collection.internal.PersistentSet"); |
| 26 | + public final static Class<?> PersistentSet = loadHibernateType("org.hibernate.collection.spi.PersistentSet"); |
27 | 27 | /** <code>PersistentSortedMap</code> contains Hibernate's PersistenSortedMap class type. */ |
28 | | - public final static Class<?> PersistentSortedMap = loadHibernateType("org.hibernate.collection.internal.PersistentSortedMap"); |
| 28 | + public final static Class<?> PersistentSortedMap = loadHibernateType( |
| 29 | + "org.hibernate.collection.spi.PersistentSortedMap"); |
29 | 30 | /** <code>PersistentSortedSet</code> contains Hibernate's PersistenSortedSet class type. */ |
30 | | - public final static Class<?> PersistentSortedSet = loadHibernateType("org.hibernate.collection.internal.PersistentSortedSet"); |
| 31 | + public final static Class<?> PersistentSortedSet = loadHibernateType( |
| 32 | + "org.hibernate.collection.spi.PersistentSortedSet"); |
31 | 33 | /** <code>EnversList</code> contains the ListProxy class type for Hibernate Envers. */ |
32 | | - public final static Class<?> EnversList = loadHibernateEnversType("org.hibernate.envers.entities.mapper.relation.lazy.proxy.ListProxy"); |
| 34 | + public final static Class<?> EnversList = loadHibernateEnversType( |
| 35 | + "org.hibernate.envers.entities.mapper.relation.lazy.proxy.ListProxy"); |
33 | 36 | /** <code>EnversMap</code> contains the MapProxy class type for Hibernate Envers. */ |
34 | | - public final static Class<?> EnversMap = loadHibernateEnversType("org.hibernate.envers.entities.mapper.relation.lazy.proxy.MapProxy"); |
| 37 | + public final static Class<?> EnversMap = loadHibernateEnversType( |
| 38 | + "org.hibernate.envers.entities.mapper.relation.lazy.proxy.MapProxy"); |
35 | 39 | /** <code>EnversSet</code> contains the SetProxy class type for Hibernate Envers. */ |
36 | | - public final static Class<?> EnversSet = loadHibernateEnversType("org.hibernate.envers.entities.mapper.relation.lazy.proxy.SetProxy"); |
| 40 | + public final static Class<?> EnversSet = loadHibernateEnversType( |
| 41 | + "org.hibernate.envers.entities.mapper.relation.lazy.proxy.SetProxy"); |
37 | 42 | /** <code>EnversSortedMap</code> contains the SortedMapProxy class type for Hibernate Envers. */ |
38 | | - public final static Class<?> EnversSortedMap = loadHibernateEnversType("org.hibernate.envers.entities.mapper.relation.lazy.proxy.SortedMapProxy"); |
| 43 | + public final static Class<?> EnversSortedMap = loadHibernateEnversType( |
| 44 | + "org.hibernate.envers.entities.mapper.relation.lazy.proxy.SortedMapProxy"); |
39 | 45 | /** <code>EnversSortedSet</code> contains the SortedSetProxy class type for Hibernate Envers. */ |
40 | | - public final static Class<?> EnversSortedSet = loadHibernateEnversType("org.hibernate.envers.entities.mapper.relation.lazy.proxy.SortedSetProxy"); |
| 46 | + public final static Class<?> EnversSortedSet = loadHibernateEnversType( |
| 47 | + "org.hibernate.envers.entities.mapper.relation.lazy.proxy.SortedSetProxy"); |
41 | 48 |
|
42 | 49 | private static Class<?> loadHibernateType(final String name) { |
43 | 50 | Class<?> type = null; |
44 | 51 | try { |
45 | 52 | try { |
46 | | - type = HibernateProxy.class.getClassLoader().loadClass(name); |
47 | | - } catch (final ClassNotFoundException e) { |
48 | | - type = HibernateProxy.class.getClassLoader().loadClass(name.replaceFirst("\\.internal\\.", ".")); |
| 53 | + try { |
| 54 | + type = HibernateProxy.class.getClassLoader().loadClass(name); |
| 55 | + } catch (ClassNotFoundException e) { |
| 56 | + // test Hibernate version 5.x |
| 57 | + type = HibernateProxy.class.getClassLoader().loadClass(name.replaceFirst("\\.spi\\.", |
| 58 | + ".internal.")); |
| 59 | + } |
| 60 | + } catch (ClassNotFoundException e) { |
| 61 | + // test Hibernate version 3.x |
| 62 | + type = HibernateProxy.class.getClassLoader().loadClass(name.replaceFirst("\\.spi\\.", ".")); |
49 | 63 | } |
50 | 64 | } catch (final ClassNotFoundException e) { |
51 | 65 | // not available |
|
0 commit comments