HHH-12730 Add deprecated constructors taking a SessionImplementor

This commit is contained in:
Guillaume Smet 2018-07-25 18:08:24 +02:00
parent 19388972dc
commit 6d7f7878e1
7 changed files with 152 additions and 0 deletions

View File

@ -86,6 +86,14 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
this.session = session;
}
/**
* * @deprecated {@link #AbstractPersistentCollection(SharedSessionContractImplementor)} should be used instead.
*/
@Deprecated
protected AbstractPersistentCollection(SessionImplementor session) {
this( (SharedSessionContractImplementor) session );
}
@Override
public final String getRole() {
return role;

View File

@ -18,6 +18,7 @@ import java.util.ListIterator;
import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister;
@ -55,6 +56,17 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
super( session );
}
/**
* Constructs a PersistentIdentifierBag.
*
* @param session The session
* @deprecated {@link #PersistentIdentifierBag(SharedSessionContractImplementor)} should be used instead.
*/
@Deprecated
public PersistentIdentifierBag(SessionImplementor session) {
this( (SharedSessionContractImplementor) session );
}
/**
* Constructs a PersistentIdentifierBag.
*
@ -78,6 +90,18 @@ public class PersistentIdentifierBag extends AbstractPersistentCollection implem
identifiers = new HashMap<>();
}
/**
* Constructs a PersistentIdentifierBag.
*
* @param session The session
* @param coll The base elements
* @deprecated {@link #PersistentIdentifierBag(SharedSessionContractImplementor, Collection)} should be used instead.
*/
@Deprecated
public PersistentIdentifierBag(SessionImplementor session, Collection coll) {
this( (SharedSessionContractImplementor) session, coll );
}
@Override
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)
throws HibernateException {

View File

@ -16,6 +16,7 @@ import java.util.List;
import java.util.ListIterator;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister;
@ -46,6 +47,17 @@ public class PersistentList extends AbstractPersistentCollection implements List
super( session );
}
/**
* Constructs a PersistentList.
*
* @param session The session
* @deprecated {@link #PersistentList(SharedSessionContractImplementor)} should be used instead.
*/
@Deprecated
public PersistentList(SessionImplementor session) {
this( (SharedSessionContractImplementor) session );
}
/**
* Constructs a PersistentList.
*
@ -59,6 +71,18 @@ public class PersistentList extends AbstractPersistentCollection implements List
setDirectlyAccessible( true );
}
/**
* Constructs a PersistentList.
*
* @param session The session
* @param list The raw list
* @deprecated {@link #PersistentList(SharedSessionContractImplementor, List)} should be used instead.
*/
@Deprecated
public PersistentList(SessionImplementor session, List list) {
this( (SharedSessionContractImplementor) session, list );
}
@Override
@SuppressWarnings( {"unchecked"})
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException {

View File

@ -18,6 +18,7 @@ import java.util.Map;
import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister;
@ -54,6 +55,17 @@ public class PersistentMap extends AbstractPersistentCollection implements Map {
super( session );
}
/**
* Instantiates a lazy map (the underlying map is un-initialized).
*
* @param session The session to which this map will belong.
* @deprecated {@link #PersistentMap(SharedSessionContractImplementor)} should be used instead.
*/
@Deprecated
public PersistentMap(SessionImplementor session) {
this( (SharedSessionContractImplementor) session );
}
/**
* Instantiates a non-lazy map (the underlying map is constructed
* from the incoming map reference).
@ -68,6 +80,19 @@ public class PersistentMap extends AbstractPersistentCollection implements Map {
setDirectlyAccessible( true );
}
/**
* Instantiates a non-lazy map (the underlying map is constructed
* from the incoming map reference).
*
* @param session The session to which this map will belong.
* @param map The underlying map data.
* @deprecated {@link #PersistentMap(SharedSessionContractImplementor, Map)} should be used instead.
*/
@Deprecated
public PersistentMap(SessionImplementor session, Map map) {
this( (SharedSessionContractImplementor) session, map );
}
@Override
@SuppressWarnings( {"unchecked"})
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException {

View File

@ -17,6 +17,7 @@ import java.util.List;
import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister;
@ -54,6 +55,17 @@ public class PersistentSet extends AbstractPersistentCollection implements java.
super( session );
}
/**
* Instantiates a lazy set (the underlying set is un-initialized).
*
* @param session The session to which this set will belong.
* @deprecated {@link #PersistentSet(SharedSessionContractImplementor)} should be used instead.
*/
@Deprecated
public PersistentSet(SessionImplementor session) {
this( (SharedSessionContractImplementor) session );
}
/**
* Instantiates a non-lazy set (the underlying set is constructed
* from the incoming set reference).
@ -72,6 +84,19 @@ public class PersistentSet extends AbstractPersistentCollection implements java.
setDirectlyAccessible( true );
}
/**
* Instantiates a non-lazy set (the underlying set is constructed
* from the incoming set reference).
*
* @param session The session to which this set will belong.
* @param set The underlying set data.
* @deprecated {@link #PersistentSet(SharedSessionContractImplementor, java.util.Set)} should be used instead.
*/
@Deprecated
public PersistentSet(SessionImplementor session, java.util.Set set) {
this( (SharedSessionContractImplementor) session, set );
}
@Override
@SuppressWarnings( {"unchecked"})
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException {

View File

@ -46,6 +46,17 @@ public class PersistentSortedMap extends PersistentMap implements SortedMap {
super( session );
}
/**
* Constructs a PersistentSortedMap.
*
* @param session The session
* @deprecated {@link #PersistentSortedMap(SharedSessionContractImplementor)} should be used instead.
*/
@Deprecated
public PersistentSortedMap(SessionImplementor session) {
this( (SharedSessionContractImplementor) session );
}
/**
* Constructs a PersistentSortedMap.
*
@ -57,6 +68,18 @@ public class PersistentSortedMap extends PersistentMap implements SortedMap {
comparator = map.comparator();
}
/**
* Constructs a PersistentSortedMap.
*
* @param session The session
* @param map The underlying map data
* @deprecated {@link #PersistentSortedMap(SharedSessionContractImplementor, SortedMap)} should be used instead.
*/
@Deprecated
public PersistentSortedMap(SessionImplementor session, SortedMap map) {
this( (SharedSessionContractImplementor) session, map );
}
@SuppressWarnings({"unchecked", "UnusedParameters"})
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode) throws HibernateException {
final TreeMap clonedMap = new TreeMap( comparator );

View File

@ -43,6 +43,17 @@ public class PersistentSortedSet extends PersistentSet implements SortedSet {
super( session );
}
/**
* Constructs a PersistentSortedSet
*
* @param session The session
* @deprecated {@link #PersistentSortedSet(SharedSessionContractImplementor)} should be used instead.
*/
@Deprecated
public PersistentSortedSet(SessionImplementor session) {
this( (SharedSessionContractImplementor) session );
}
/**
* Constructs a PersistentSortedSet
*
@ -54,6 +65,18 @@ public class PersistentSortedSet extends PersistentSet implements SortedSet {
comparator = set.comparator();
}
/**
* Constructs a PersistentSortedSet
*
* @param session The session
* @param set The underlying set data
* @deprecated {@link #PersistentSortedSet(SharedSessionContractImplementor, SortedSet)} should be used instead.
*/
@Deprecated
public PersistentSortedSet(SessionImplementor session, SortedSet set) {
this( (SharedSessionContractImplementor) session, set );
}
@SuppressWarnings({"unchecked", "UnusedParameters"})
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode)
throws HibernateException {