HHH-12730 Add deprecated constructors taking a SessionImplementor

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

View File

@ -86,6 +86,14 @@ protected AbstractPersistentCollection(SharedSessionContractImplementor session)
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.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 PersistentIdentifierBag(SharedSessionContractImplementor session) {
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 PersistentIdentifierBag(SharedSessionContractImplementor session, Collect
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.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 PersistentList(SharedSessionContractImplementor session) {
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 PersistentList(SharedSessionContractImplementor session, List 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.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 PersistentMap(SharedSessionContractImplementor session) {
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 PersistentMap(SharedSessionContractImplementor session, Map 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.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 PersistentSet(SharedSessionContractImplementor session) {
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 PersistentSet(SharedSessionContractImplementor session, java.util.Set set
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 PersistentSortedMap(SharedSessionContractImplementor session) {
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 PersistentSortedMap(SharedSessionContractImplementor session, SortedMap m
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 PersistentSortedSet(SharedSessionContractImplementor session) {
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 PersistentSortedSet(SharedSessionContractImplementor session, SortedSet s
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 {