Skip to content

Commit ad78941

Browse files
dreab8sebersole
authored andcommitted
HHH-10664 - Fix SortedSet issue
1 parent 8b7fbcb commit ad78941

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed

hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentSortedMap.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.hibernate.EntityMode;
1818
import org.hibernate.HibernateException;
1919
import org.hibernate.engine.spi.SessionImplementor;
20+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
2021
import org.hibernate.persister.collection.BasicCollectionPersister;
2122

2223
/**
@@ -41,7 +42,7 @@ public PersistentSortedMap() {
4142
*
4243
* @param session The session
4344
*/
44-
public PersistentSortedMap(SessionImplementor session) {
45+
public PersistentSortedMap(SharedSessionContractImplementor session) {
4546
super( session );
4647
}
4748

@@ -51,7 +52,7 @@ public PersistentSortedMap(SessionImplementor session) {
5152
* @param session The session
5253
* @param map The underlying map data
5354
*/
54-
public PersistentSortedMap(SessionImplementor session, SortedMap map) {
55+
public PersistentSortedMap(SharedSessionContractImplementor session, SortedMap map) {
5556
super( session, map );
5657
comparator = map.comparator();
5758
}

hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentSortedSet.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.hibernate.EntityMode;
1515
import org.hibernate.HibernateException;
1616
import org.hibernate.engine.spi.SessionImplementor;
17+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1718
import org.hibernate.persister.collection.BasicCollectionPersister;
1819

1920
/**
@@ -38,7 +39,7 @@ public PersistentSortedSet() {
3839
*
3940
* @param session The session
4041
*/
41-
public PersistentSortedSet(SessionImplementor session) {
42+
public PersistentSortedSet(SharedSessionContractImplementor session) {
4243
super( session );
4344
}
4445

@@ -48,7 +49,7 @@ public PersistentSortedSet(SessionImplementor session) {
4849
* @param session The session
4950
* @param set The underlying set data
5051
*/
51-
public PersistentSortedSet(SessionImplementor session, SortedSet set) {
52+
public PersistentSortedSet(SharedSessionContractImplementor session, SortedSet set) {
5253
super( session, set );
5354
comparator = set.comparator();
5455
}

hibernate-core/src/main/java/org/hibernate/type/EmbeddedComponentType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.lang.reflect.Method;
1010

1111
import org.hibernate.HibernateException;
12-
import org.hibernate.engine.spi.SessionImplementor;
12+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1313
import org.hibernate.tuple.component.ComponentMetamodel;
1414

1515
/**
@@ -28,7 +28,8 @@ public boolean isMethodOf(Method method) {
2828
return componentTuplizer.isMethodOf( method );
2929
}
3030

31-
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException {
31+
@Override
32+
public Object instantiate(Object parent, SharedSessionContractImplementor session) throws HibernateException {
3233
final boolean useParent = parent != null &&
3334
//TODO: Yuck! This is not quite good enough, it's a quick
3435
//hack around the problem of having a to-one association

hibernate-core/src/main/java/org/hibernate/type/SortedMapType.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import org.hibernate.collection.internal.PersistentSortedMap;
1414
import org.hibernate.collection.spi.PersistentCollection;
15-
import org.hibernate.engine.spi.SessionImplementor;
15+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1616
import org.hibernate.persister.collection.CollectionPersister;
1717

1818

@@ -25,7 +25,8 @@ public SortedMapType(TypeFactory.TypeScope typeScope, String role, String proper
2525
this.comparator = comparator;
2626
}
2727

28-
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
28+
@Override
29+
public PersistentCollection instantiate(SharedSessionContractImplementor session, CollectionPersister persister, Serializable key) {
2930
PersistentSortedMap map = new PersistentSortedMap(session);
3031
map.setComparator(comparator);
3132
return map;
@@ -39,8 +40,9 @@ public Class getReturnedClass() {
3940
public Object instantiate(int anticipatedSize) {
4041
return new TreeMap(comparator);
4142
}
42-
43-
public PersistentCollection wrap(SessionImplementor session, Object collection) {
43+
44+
@Override
45+
public PersistentCollection wrap(SharedSessionContractImplementor session, Object collection) {
4446
return new PersistentSortedMap( session, (java.util.SortedMap) collection );
4547
}
4648
}

hibernate-core/src/main/java/org/hibernate/type/SortedSetType.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import org.hibernate.collection.internal.PersistentSortedSet;
1414
import org.hibernate.collection.spi.PersistentCollection;
15-
import org.hibernate.engine.spi.SessionImplementor;
15+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1616
import org.hibernate.persister.collection.CollectionPersister;
1717

1818
public class SortedSetType extends SetType {
@@ -23,7 +23,8 @@ public SortedSetType(TypeFactory.TypeScope typeScope, String role, String proper
2323
this.comparator = comparator;
2424
}
2525

26-
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
26+
@Override
27+
public PersistentCollection instantiate(SharedSessionContractImplementor session, CollectionPersister persister, Serializable key) {
2728
PersistentSortedSet set = new PersistentSortedSet(session);
2829
set.setComparator(comparator);
2930
return set;
@@ -37,8 +38,9 @@ public Class getReturnedClass() {
3738
public Object instantiate(int anticipatedSize) {
3839
return new TreeSet(comparator);
3940
}
40-
41-
public PersistentCollection wrap(SessionImplementor session, Object collection) {
41+
42+
@Override
43+
public PersistentCollection wrap(SharedSessionContractImplementor session, Object collection) {
4244
return new PersistentSortedSet( session, (java.util.SortedSet) collection );
4345
}
4446
}

hibernate-core/src/main/java/org/hibernate/type/SpecialOneToOneType.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import org.hibernate.MappingException;
1616
import org.hibernate.engine.internal.ForeignKeys;
1717
import org.hibernate.engine.spi.Mapping;
18-
import org.hibernate.engine.spi.SessionImplementor;
1918
import org.hibernate.engine.jdbc.Size;
19+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
2020

2121
/**
2222
* A one-to-one association that maps to specific formula(s)
@@ -86,16 +86,17 @@ public Size[] defaultSizes(Mapping mapping) throws MappingException {
8686
public boolean useLHSPrimaryKey() {
8787
return false;
8888
}
89-
90-
public Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner)
89+
90+
@Override
91+
public Object hydrate(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
9192
throws HibernateException, SQLException {
9293
return super.getIdentifierOrUniqueKeyType( session.getFactory() )
9394
.nullSafeGet(rs, names, session, owner);
9495
}
9596

9697
// TODO: copy/paste from ManyToOneType
97-
98-
public Serializable disassemble(Object value, SessionImplementor session, Object owner)
98+
@Override
99+
public Serializable disassemble(Object value, SharedSessionContractImplementor session, Object owner)
99100
throws HibernateException {
100101

101102
if (value==null) {
@@ -115,7 +116,8 @@ public Serializable disassemble(Object value, SessionImplementor session, Object
115116
}
116117
}
117118

118-
public Object assemble(Serializable oid, SessionImplementor session, Object owner)
119+
@Override
120+
public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner)
119121
throws HibernateException {
120122
//TODO: currently broken for unique-key references (does not detect
121123
// change to unique key property of the associated object)

0 commit comments

Comments
 (0)