Merge pull request #3093 from ebean-orm/deprecated/BeanFinder-server

Remove deprecated Query setLoadBeanCache() - migrate to setBeanCacheM…
This commit is contained in:
Rob Bygrave
2023-06-01 20:45:34 +12:00
committed by GitHub
5 changed files with 3 additions and 32 deletions
@@ -1579,14 +1579,6 @@ public interface Query<T> extends CancelableQuery {
*/
Query<T> setReadOnly(boolean readOnly);
/**
* Deprecated - migrate to use setBeanCacheMode(CacheMode.PUT) or other CacheMode.
* <p>
* When set to true all the beans from this query are loaded into the bean cache.
*/
@Deprecated
Query<T> setLoadBeanCache(boolean loadBeanCache);
/**
* Set a timeout on this query.
* <p>
@@ -500,11 +500,6 @@ final class DefaultFetchGroupQuery<T> implements SpiFetchGroupQuery<T>, SpiQuery
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}
@Override
public Query<T> setLoadBeanCache(boolean loadBeanCache) {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}
@Override
public Query<T> setTimeout(int secs) {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
@@ -1276,12 +1276,6 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
return this;
}
@Override
public final Query<T> setLoadBeanCache(boolean loadBeanCache) {
this.useBeanCache = loadBeanCache ? CacheMode.PUT : CacheMode.OFF;
return this;
}
@Override
public final Query<T> setTimeout(int secs) {
this.timeout = secs;
@@ -913,17 +913,6 @@ public abstract class TQRootBean<T, R> {
return root;
}
/**
* Deprecated migrate to setBeanCacheMode() or setUseCache().
* <p>
* When set to true all the beans from this query are loaded into the bean cache.
*/
@Deprecated
public R setLoadBeanCache(boolean loadBeanCache) {
query.setLoadBeanCache(loadBeanCache);
return root;
}
/**
* Set the property to use as keys for a map.
* <p>
@@ -1,5 +1,6 @@
package org.tests.basic;
import io.ebean.CacheMode;
import io.ebean.Query;
import io.ebean.xtest.BaseTestCase;
import io.ebean.DB;
@@ -20,7 +21,7 @@ class TestLoadBeanCache extends BaseTestCase {
@Test
void loadBeanCache_false() {
Query<Country> query = DB.find(Country.class).setLoadBeanCache(false);
Query<Country> query = DB.find(Country.class).setBeanCacheMode(CacheMode.OFF);
SpiQuery<?> spiQuery = (SpiQuery<?>) query;
assertThat(spiQuery.isBeanCachePut()).isFalse();
@@ -32,7 +33,7 @@ class TestLoadBeanCache extends BaseTestCase {
ResetBasicData.reset();
Map<String, Country> map = DB.find(Country.class)
.setLoadBeanCache(true)
.setBeanCacheMode(CacheMode.PUT)
.setUseQueryCache(true)
.setReadOnly(true)
.order("name")