HHH-13444 Remove ignored EntityMode field from CollectionKey
This commit is contained in:
parent
a01929c5b8
commit
9e9154cb5e
|
@ -93,8 +93,7 @@ public class CollectionLoadContext {
|
|||
* @return The loading collection (see discussion above).
|
||||
*/
|
||||
public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key) {
|
||||
final EntityMode em = persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode();
|
||||
final CollectionKey collectionKey = new CollectionKey( persister, key, em );
|
||||
final CollectionKey collectionKey = new CollectionKey( persister, key );
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
LOG.tracev( "Starting attempt to find loading collection [{0}]",
|
||||
MessageHelper.collectionInfoString( persister.getRole(), key ) );
|
||||
|
@ -179,8 +178,7 @@ public class CollectionLoadContext {
|
|||
session.getPersistenceContext().addUnownedCollection(
|
||||
new CollectionKey(
|
||||
persister,
|
||||
lce.getKey(),
|
||||
persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode()
|
||||
lce.getKey()
|
||||
),
|
||||
lce.getCollection()
|
||||
);
|
||||
|
|
|
@ -27,32 +27,33 @@ public final class CollectionKey implements Serializable {
|
|||
private final Type keyType;
|
||||
private final SessionFactoryImplementor factory;
|
||||
private final int hashCode;
|
||||
private EntityMode entityMode;
|
||||
|
||||
public CollectionKey(CollectionPersister persister, Serializable key) {
|
||||
this(
|
||||
persister.getRole(),
|
||||
key,
|
||||
persister.getKeyType(),
|
||||
persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode(),
|
||||
persister.getFactory()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The EntityMode parameter is now ignored. Use the other constructor.
|
||||
* @deprecated Use {@link #CollectionKey(CollectionPersister, Serializable)}
|
||||
*/
|
||||
@Deprecated
|
||||
public CollectionKey(CollectionPersister persister, Serializable key, EntityMode em) {
|
||||
this( persister.getRole(), key, persister.getKeyType(), em, persister.getFactory() );
|
||||
this( persister.getRole(), key, persister.getKeyType(), persister.getFactory() );
|
||||
}
|
||||
|
||||
private CollectionKey(
|
||||
String role,
|
||||
Serializable key,
|
||||
Type keyType,
|
||||
EntityMode entityMode,
|
||||
SessionFactoryImplementor factory) {
|
||||
this.role = role;
|
||||
this.key = key;
|
||||
this.keyType = keyType;
|
||||
this.entityMode = entityMode;
|
||||
this.factory = factory;
|
||||
//cache the hash-code
|
||||
this.hashCode = generateHashCode();
|
||||
|
@ -65,7 +66,6 @@ public final class CollectionKey implements Serializable {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
@ -112,7 +112,6 @@ public final class CollectionKey implements Serializable {
|
|||
oos.writeObject( role );
|
||||
oos.writeObject( key );
|
||||
oos.writeObject( keyType );
|
||||
oos.writeObject( entityMode.toString() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +133,6 @@ public final class CollectionKey implements Serializable {
|
|||
(String) ois.readObject(),
|
||||
(Serializable) ois.readObject(),
|
||||
(Type) ois.readObject(),
|
||||
EntityMode.parse( (String) ois.readObject() ),
|
||||
(session == null ? null : session.getFactory())
|
||||
);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Set;
|
|||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -46,7 +45,6 @@ import org.hibernate.persister.entity.Joinable;
|
|||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -771,7 +769,6 @@ public abstract class CollectionType extends AbstractType implements Association
|
|||
|
||||
final CollectionPersister persister = getPersister( session );
|
||||
final PersistenceContext persistenceContext = session.getPersistenceContext();
|
||||
final EntityMode entityMode = persister.getOwnerEntityPersister().getEntityMode();
|
||||
|
||||
final CollectionKey collectionKey = new CollectionKey( persister, key );
|
||||
// check if collection is currently being loaded
|
||||
|
@ -805,7 +802,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
|||
}
|
||||
|
||||
if ( hasHolder() ) {
|
||||
session.getPersistenceContext().addCollectionHolder( collection );
|
||||
persistenceContext.addCollectionHolder( collection );
|
||||
}
|
||||
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
|
|
Loading…
Reference in New Issue