#3270 Fix for use with BeanFindController and attribute queries

The existence of a BeanFindController should not break the use of
single attribute queries + still allow auto-tuning.
This commit is contained in:
Rob Bygrave
2023-11-21 22:04:47 +13:00
parent 496ef36b11
commit 0da3772ae9
3 changed files with 3 additions and 3 deletions
@@ -961,7 +961,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
if (!query.isRawSql()) {
query.setDefaultRawSqlIfRequired();
if (query.isAutoTunable() && !autoTuneService.tuneQuery(query)) {
if (!query.isAutoTunable() || !autoTuneService.tuneQuery(query)) {
// use deployment FetchType.LAZY/EAGER annotations
// to define the 'default' select clause
query.setDefaultSelectClause();
@@ -278,7 +278,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
this.partitionMeta = deploy.getPartitionMeta();
this.tablespaceMeta = deploy.getTablespaceMeta();
this.storageEngine = deploy.getStorageEngine();
this.autoTunable = beanFinder == null && (entityType == EntityType.ORM || entityType == EntityType.VIEW);
this.autoTunable = entityType == EntityType.ORM || entityType == EntityType.VIEW;
// helper object used to derive lists of properties
DeployBeanPropertyLists listHelper = new DeployBeanPropertyLists(owner, this, deploy);
this.softDeleteProperty = listHelper.getSoftDeleteProperty();
@@ -26,7 +26,7 @@ public class SpiServerTest extends BaseTestCase {
BeanType<Customer> beanType = pluginApi.beanType(Customer.class);
assertEquals("o_customer", beanType.baseTable());
assertNotNull(pluginApi.databasePlatform());
assertNull(beanType.findController());
assertNotNull(beanType.findController());
assertNotNull(beanType.persistController());
assertNull(beanType.persistListener());
assertNull(beanType.queryAdapter());