HHH-15702 also add matching getters

This commit is contained in:
Gavin King 2022-11-10 10:39:24 +01:00
parent 778675b867
commit 215d411ffa
6 changed files with 64 additions and 0 deletions

View File

@ -205,6 +205,20 @@ public interface Session extends SharedSessionContract, EntityManager {
*/
CacheMode getCacheMode();
/**
* The JPA-defined {@link CacheStoreMode}.
*
* @see #getCacheMode()
*/
CacheStoreMode getCacheStoreMode();
/**
* The JPA-defined {@link CacheRetrieveMode}.
*
* @see #getCacheMode()
*/
CacheRetrieveMode getCacheRetrieveMode();
/**
* Enable or disable writes to the second-level cache.
*

View File

@ -202,6 +202,16 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
return delegate.getCacheMode();
}
@Override
public CacheRetrieveMode getCacheRetrieveMode() {
return delegate.getCacheRetrieveMode();
}
@Override
public CacheStoreMode getCacheStoreMode() {
return delegate.getCacheStoreMode();
}
@Override
public void setCacheMode(CacheMode cm) {
delegate.setCacheMode( cm );

View File

@ -111,6 +111,16 @@ public class SessionLazyDelegator implements Session {
this.lazySession.get().setCacheStoreMode( cacheStoreMode );
}
@Override
public CacheStoreMode getCacheStoreMode() {
return this.lazySession.get().getCacheStoreMode();
}
@Override
public CacheRetrieveMode getCacheRetrieveMode() {
return this.lazySession.get().getCacheRetrieveMode();
}
@Override
public CacheMode getCacheMode() {
return this.lazySession.get().getCacheMode();

View File

@ -1836,6 +1836,16 @@ public class SessionImpl
persistenceContext.setReadOnly( entity, readOnly );
}
@Override
public CacheStoreMode getCacheStoreMode() {
return getCacheMode().getJpaStoreMode();
}
@Override
public CacheRetrieveMode getCacheRetrieveMode() {
return getCacheMode().getJpaRetrieveMode();
}
@Override
public void setCacheStoreMode(CacheStoreMode cacheStoreMode) {
setCacheMode( fromJpaModes( getCacheMode().getJpaRetrieveMode(), cacheStoreMode ) );

View File

@ -285,6 +285,16 @@ public interface SelectionQuery<R> extends CommonQueryContract {
*/
CacheMode getCacheMode();
/**
* @see #getCacheMode()
*/
CacheStoreMode getCacheStoreMode();
/**
* @see #getCacheMode()
*/
CacheRetrieveMode getCacheRetrieveMode();
/**
* Set the current {@link CacheMode} in effect for this query.
*

View File

@ -686,6 +686,16 @@ public abstract class AbstractSelectionQuery<R>
return getQueryOptions().getCacheMode();
}
@Override
public CacheStoreMode getCacheStoreMode() {
return getCacheMode().getJpaStoreMode();
}
@Override
public CacheRetrieveMode getCacheRetrieveMode() {
return getCacheMode().getJpaRetrieveMode();
}
@Override
public SelectionQuery<R> setCacheMode(CacheMode cacheMode) {
getQueryOptions().setCacheMode( cacheMode );