Removed deprecated setFlushMode from Session and SharedSessionContractImplementor
Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
parent
8b0f70f066
commit
13527366c9
|
@ -117,7 +117,7 @@ public interface Session extends SharedSessionContract, EntityManager {
|
||||||
/**
|
/**
|
||||||
* Force this session to flush. Must be called at the end of a unit of work,
|
* Force this session to flush. Must be called at the end of a unit of work,
|
||||||
* before the transaction is committed. Depending on the current
|
* before the transaction is committed. Depending on the current
|
||||||
* {@link #setFlushMode(FlushMode) flush mode}, the session might automatically
|
* {@link #setHibernateFlushMode(FlushMode)} flush mode}, the session might automatically
|
||||||
* flush when {@link Transaction#commit()} is called, and it is not necessary
|
* flush when {@link Transaction#commit()} is called, and it is not necessary
|
||||||
* to call this method directly.
|
* to call this method directly.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -128,25 +128,6 @@ public interface Session extends SharedSessionContract, EntityManager {
|
||||||
*/
|
*/
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the current {@link FlushMode flush mode} for this session.
|
|
||||||
* <p>
|
|
||||||
* <em>Flushing</em> is the process of synchronizing the underlying persistent
|
|
||||||
* store with persistable state held in memory. The current flush mode determines
|
|
||||||
* when the session is automatically flushed.
|
|
||||||
* <p>
|
|
||||||
* The {@link FlushMode#AUTO default flush mode} is sometimes unnecessarily
|
|
||||||
* aggressive. For a logically "read only" session, it's reasonable to set the
|
|
||||||
* session's flush mode to {@link FlushMode#MANUAL} at the start of the session
|
|
||||||
* in order to avoid some unnecessary work.
|
|
||||||
*
|
|
||||||
* @param flushMode the new {@link FlushMode}
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #setHibernateFlushMode(FlushMode)}
|
|
||||||
*/
|
|
||||||
@Deprecated(since="5.2")
|
|
||||||
void setFlushMode(FlushMode flushMode);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current {@link FlushModeType JPA flush mode} for this session.
|
* Set the current {@link FlushModeType JPA flush mode} for this session.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -278,7 +278,7 @@ public abstract class AbstractPersistentCollection<E> implements Serializable, P
|
||||||
final SessionFactoryImplementor sf = SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
|
final SessionFactoryImplementor sf = SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
|
||||||
final SharedSessionContractImplementor session = (SharedSessionContractImplementor) sf.openSession();
|
final SharedSessionContractImplementor session = (SharedSessionContractImplementor) sf.openSession();
|
||||||
session.getPersistenceContextInternal().setDefaultReadOnly( true );
|
session.getPersistenceContextInternal().setDefaultReadOnly( true );
|
||||||
session.setFlushMode( FlushMode.MANUAL );
|
session.setHibernateFlushMode( FlushMode.MANUAL );
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,11 +264,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
return delegate.getHibernateFlushMode();
|
return delegate.getHibernateFlushMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlushMode(FlushMode fm) {
|
|
||||||
delegate.setHibernateFlushMode( fm );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void lock(Object entity, LockModeType lockMode) {
|
public void lock(Object entity, LockModeType lockMode) {
|
||||||
delegate.lock( entity, lockMode );
|
delegate.lock( entity, lockMode );
|
||||||
|
|
|
@ -336,24 +336,6 @@ public interface SharedSessionContractImplementor
|
||||||
|
|
||||||
boolean isCriteriaCopyTreeEnabled();
|
boolean isCriteriaCopyTreeEnabled();
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the flush mode for this session.
|
|
||||||
* <p/>
|
|
||||||
* The flush mode determines the points at which the session is flushed.
|
|
||||||
* <i>Flushing</i> is the process of synchronizing the underlying persistent
|
|
||||||
* store with persistable state held in memory.
|
|
||||||
* <p/>
|
|
||||||
* For a logically "read only" session, it is reasonable to set the session's
|
|
||||||
* flush mode to {@link FlushMode#MANUAL} at the start of the session (in
|
|
||||||
* order to achieve some extra performance).
|
|
||||||
*
|
|
||||||
* @param flushMode the new flush mode
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #setHibernateFlushMode(FlushMode)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "5.2")
|
|
||||||
void setFlushMode(FlushMode flushMode);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the flush mode for this session.
|
* Get the flush mode for this session.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
|
@ -615,11 +615,6 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
return getFactory().getJdbcServices();
|
return getFactory().getJdbcServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlushMode(FlushMode flushMode) {
|
|
||||||
setHibernateFlushMode( flushMode );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FlushModeType getFlushMode() {
|
public FlushModeType getFlushMode() {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
|
|
|
@ -503,11 +503,6 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlushMode(FlushMode fm) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHibernateFlushMode(FlushMode flushMode) {
|
public void setHibernateFlushMode(FlushMode flushMode) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
|
@ -196,7 +196,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
||||||
SessionFactoryImplementor sf = SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
|
SessionFactoryImplementor sf = SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
|
||||||
SharedSessionContractImplementor session = (SharedSessionContractImplementor) sf.openSession();
|
SharedSessionContractImplementor session = (SharedSessionContractImplementor) sf.openSession();
|
||||||
session.getPersistenceContext().setDefaultReadOnly( true );
|
session.getPersistenceContext().setDefaultReadOnly( true );
|
||||||
session.setFlushMode( FlushMode.MANUAL );
|
session.setHibernateFlushMode( FlushMode.MANUAL );
|
||||||
|
|
||||||
boolean isJTA = session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta();
|
boolean isJTA = session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta();
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ public class EntityManagerTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
EntityManager em = getOrCreateEntityManager();
|
EntityManager em = getOrCreateEntityManager();
|
||||||
em.setFlushMode( FlushModeType.COMMIT );
|
em.setFlushMode( FlushModeType.COMMIT );
|
||||||
assertEquals( FlushModeType.COMMIT, em.getFlushMode() );
|
assertEquals( FlushModeType.COMMIT, em.getFlushMode() );
|
||||||
( (Session) em ).setFlushMode( FlushMode.ALWAYS );
|
( (Session) em ).setHibernateFlushMode( FlushMode.ALWAYS );
|
||||||
assertEquals( em.getFlushMode(), FlushModeType.AUTO );
|
assertEquals( em.getFlushMode(), FlushModeType.AUTO );
|
||||||
em.close();
|
em.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,7 +470,7 @@ public class ProxyTest extends BaseCoreFunctionalTestCase {
|
||||||
s.close();
|
s.close();
|
||||||
|
|
||||||
s = openSession();
|
s = openSession();
|
||||||
s.setFlushMode( FlushMode.MANUAL );
|
s.setHibernateFlushMode( FlushMode.MANUAL );
|
||||||
t = s.beginTransaction();
|
t = s.beginTransaction();
|
||||||
// load the last container as a proxy
|
// load the last container as a proxy
|
||||||
Container proxy = s.load( Container.class, lastContainerId );
|
Container proxy = s.load( Container.class, lastContainerId );
|
||||||
|
|
|
@ -46,6 +46,6 @@ public abstract class AbstractFlushTest extends BaseEnversJPAFunctionalTestCase
|
||||||
@Before
|
@Before
|
||||||
public void initFlush() throws IOException {
|
public void initFlush() throws IOException {
|
||||||
Session session = getSession( getEntityManager() );
|
Session session = getSession( getEntityManager() );
|
||||||
session.setFlushMode( getFlushMode() );
|
session.setHibernateFlushMode( getFlushMode() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue