package org.hibernate.engine.internal;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import org.hibernate.EntityMode;
import org.hibernate.LockMode;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.persister.entity.EntityPersister;
public final class MutableEntityEntry extends AbstractEntityEntry {
@Deprecated
public MutableEntityEntry(
final Status status,
final Object[] loadedState,
final Object rowId,
final Serializable id,
final Object version,
final LockMode lockMode,
final boolean existsInDatabase,
final EntityPersister persister,
final EntityMode entityMode,
final String tenantId,
final boolean disableVersionIncrement,
final PersistenceContext persistenceContext) {
this( status, loadedState, rowId, id, version, lockMode, existsInDatabase,
persister,disableVersionIncrement, persistenceContext
);
}
public MutableEntityEntry(
final Status status,
final Object[] loadedState,
final Object rowId,
final Serializable id,
final Object version,
final LockMode lockMode,
final boolean existsInDatabase,
final EntityPersister persister,
final boolean disableVersionIncrement,
final PersistenceContext persistenceContext) {
super( status, loadedState, rowId, id, version, lockMode, existsInDatabase, persister,
disableVersionIncrement, persistenceContext
);
}
@SuppressWarnings( {"JavaDoc"})
private MutableEntityEntry(
final SessionFactoryImplementor factory,
final String entityName,
final Serializable id,
final Status status,
final Status previousStatus,
final Object[] loadedState,
final Object[] deletedState,
final Object version,
final LockMode lockMode,
final boolean existsInDatabase,
final boolean isBeingReplicated,
final PersistenceContext persistenceContext) {
super( factory, entityName, id, status, previousStatus, loadedState, deletedState,
version, lockMode, existsInDatabase, isBeingReplicated, persistenceContext
);
}
public static EntityEntry deserialize(
ObjectInputStream ois,
PersistenceContext persistenceContext) throws IOException, ClassNotFoundException {
String previousStatusString;
return new MutableEntityEntry(
persistenceContext.getSession().getFactory(),
(String) ois.readObject(),
(Serializable) ois.readObject(),
Status.valueOf( (String) ois.readObject() ),
( previousStatusString = (String) ois.readObject() ).length() == 0
? null
: Status.valueOf( previousStatusString ),
(Object[]) ois.readObject(),
(Object[]) ois.readObject(),
ois.readObject(),
LockMode.valueOf( (String) ois.readObject() ),
ois.readBoolean(),
ois.readBoolean(),
persistenceContext
);
}
}