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