CollectionKeypublic final class CollectionKey extends Object implements SerializableUniquely identifies a collection instance in a particular session. |
Fields Summary |
---|
private final String | role | private final Serializable | key | private final org.hibernate.type.Type | keyType | private final SessionFactoryImplementor | factory | private final int | hashCode | private org.hibernate.EntityMode | entityMode |
Constructors Summary |
---|
public CollectionKey(org.hibernate.persister.collection.CollectionPersister persister, Serializable key, org.hibernate.EntityMode em)
this( persister.getRole(), key, persister.getKeyType(), em, persister.getFactory() );
| private CollectionKey(String role, Serializable key, org.hibernate.type.Type keyType, org.hibernate.EntityMode entityMode, SessionFactoryImplementor factory)
this.role = role;
this.key = key;
this.keyType = keyType;
this.entityMode = entityMode;
this.factory = factory;
this.hashCode = generateHashCode(); //cache the hashcode
|
Methods Summary |
---|
static org.hibernate.engine.CollectionKey | deserialize(java.io.ObjectInputStream ois, SessionImplementor session)Custom deserialization routine used during deserialization of a
Session/PersistenceContext for increased performance.
return new CollectionKey(
( String ) ois.readObject(),
( Serializable ) ois.readObject(),
( Type ) ois.readObject(),
EntityMode.parse( ( String ) ois.readObject() ),
session.getFactory()
);
| public boolean | equals(java.lang.Object other)
CollectionKey that = (CollectionKey) other;
return that.role.equals(role) &&
keyType.isEqual(that.key, key, entityMode, factory);
| public int | generateHashCode()
int result = 17;
result = 37 * result + role.hashCode();
result = 37 * result + keyType.getHashCode(key, entityMode, factory);
return result;
| public java.io.Serializable | getKey()
return key;
| public java.lang.String | getRole()
return role;
| public int | hashCode()
return hashCode;
| void | serialize(java.io.ObjectOutputStream oos)Custom serialization routine used during serialization of a
Session/PersistenceContext for increased performance.
oos.writeObject( role );
oos.writeObject( key );
oos.writeObject( keyType );
oos.writeObject( entityMode.toString() );
| public java.lang.String | toString()
return "CollectionKey" +
MessageHelper.collectionInfoString( factory.getCollectionPersister(role), key, factory );
|
|