HHH-10664 - Fix SortedSet issue

This commit is contained in:
Andrea Boriero 2016-04-25 17:11:04 +01:00 committed by Steve Ebersole
parent b4b158aaff
commit 5c5de945e5
6 changed files with 29 additions and 20 deletions

View File

@ -17,6 +17,7 @@ import java.util.TreeMap;
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.persister.collection.BasicCollectionPersister;
/**
@ -41,7 +42,7 @@ public class PersistentSortedMap extends PersistentMap implements SortedMap {
*
* @param session The session
*/
public PersistentSortedMap(SessionImplementor session) {
public PersistentSortedMap(SharedSessionContractImplementor session) {
super( session );
}
@ -51,7 +52,7 @@ public class PersistentSortedMap extends PersistentMap implements SortedMap {
* @param session The session
* @param map The underlying map data
*/
public PersistentSortedMap(SessionImplementor session, SortedMap map) {
public PersistentSortedMap(SharedSessionContractImplementor session, SortedMap map) {
super( session, map );
comparator = map.comparator();
}

View File

@ -14,6 +14,7 @@ import java.util.TreeMap;
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.persister.collection.BasicCollectionPersister;
/**
@ -38,7 +39,7 @@ public class PersistentSortedSet extends PersistentSet implements SortedSet {
*
* @param session The session
*/
public PersistentSortedSet(SessionImplementor session) {
public PersistentSortedSet(SharedSessionContractImplementor session) {
super( session );
}
@ -48,7 +49,7 @@ public class PersistentSortedSet extends PersistentSet implements SortedSet {
* @param session The session
* @param set The underlying set data
*/
public PersistentSortedSet(SessionImplementor session, SortedSet set) {
public PersistentSortedSet(SharedSessionContractImplementor session, SortedSet set) {
super( session, set );
comparator = set.comparator();
}

View File

@ -9,7 +9,7 @@ package org.hibernate.type;
import java.lang.reflect.Method;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.tuple.component.ComponentMetamodel;
/**
@ -28,7 +28,8 @@ public class EmbeddedComponentType extends ComponentType {
return componentTuplizer.isMethodOf( method );
}
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException {
@Override
public Object instantiate(Object parent, SharedSessionContractImplementor session) throws HibernateException {
final boolean useParent = parent != null &&
//TODO: Yuck! This is not quite good enough, it's a quick
//hack around the problem of having a to-one association

View File

@ -12,7 +12,7 @@ import java.util.TreeMap;
import org.hibernate.collection.internal.PersistentSortedMap;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.persister.collection.CollectionPersister;
@ -25,7 +25,8 @@ public class SortedMapType extends MapType {
this.comparator = comparator;
}
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
@Override
public PersistentCollection instantiate(SharedSessionContractImplementor session, CollectionPersister persister, Serializable key) {
PersistentSortedMap map = new PersistentSortedMap(session);
map.setComparator(comparator);
return map;
@ -40,7 +41,8 @@ public class SortedMapType extends MapType {
return new TreeMap(comparator);
}
public PersistentCollection wrap(SessionImplementor session, Object collection) {
@Override
public PersistentCollection wrap(SharedSessionContractImplementor session, Object collection) {
return new PersistentSortedMap( session, (java.util.SortedMap) collection );
}
}

View File

@ -12,7 +12,7 @@ import java.util.TreeSet;
import org.hibernate.collection.internal.PersistentSortedSet;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.persister.collection.CollectionPersister;
public class SortedSetType extends SetType {
@ -23,7 +23,8 @@ public class SortedSetType extends SetType {
this.comparator = comparator;
}
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
@Override
public PersistentCollection instantiate(SharedSessionContractImplementor session, CollectionPersister persister, Serializable key) {
PersistentSortedSet set = new PersistentSortedSet(session);
set.setComparator(comparator);
return set;
@ -38,7 +39,8 @@ public class SortedSetType extends SetType {
return new TreeSet(comparator);
}
public PersistentCollection wrap(SessionImplementor session, Object collection) {
@Override
public PersistentCollection wrap(SharedSessionContractImplementor session, Object collection) {
return new PersistentSortedSet( session, (java.util.SortedSet) collection );
}
}

View File

@ -15,8 +15,8 @@ import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.engine.internal.ForeignKeys;
import org.hibernate.engine.spi.Mapping;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.jdbc.Size;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
/**
* A one-to-one association that maps to specific formula(s)
@ -87,15 +87,16 @@ public class SpecialOneToOneType extends OneToOneType {
return false;
}
public Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner)
@Override
public Object hydrate(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
throws HibernateException, SQLException {
return super.getIdentifierOrUniqueKeyType( session.getFactory() )
.nullSafeGet(rs, names, session, owner);
}
// TODO: copy/paste from ManyToOneType
public Serializable disassemble(Object value, SessionImplementor session, Object owner)
@Override
public Serializable disassemble(Object value, SharedSessionContractImplementor session, Object owner)
throws HibernateException {
if (value==null) {
@ -115,7 +116,8 @@ public class SpecialOneToOneType extends OneToOneType {
}
}
public Object assemble(Serializable oid, SessionImplementor session, Object owner)
@Override
public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner)
throws HibernateException {
//TODO: currently broken for unique-key references (does not detect
// change to unique key property of the associated object)