Merge branch 'FOCONIS-findsingleattribute-beanfindcontroller'

This commit is contained in:
Rob Bygrave
2023-11-21 22:05:12 +13:00
4 changed files with 38 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());
@@ -0,0 +1,35 @@
package org.tests.model.basic;
import io.ebean.bean.BeanCollection;
import io.ebean.event.BeanFindController;
import io.ebean.event.BeanQueryRequest;
/**
* @author Noemi Praml, FOCONIS AG
*/
public class CustomerFindController implements BeanFindController {
@Override
public boolean isRegisterFor(Class<?> cls) {
return Customer.class.isAssignableFrom(cls);
}
@Override
public boolean isInterceptFind(BeanQueryRequest<?> request) {
return false;
}
@Override
public <T> T find(BeanQueryRequest<T> request) {
return null;
}
@Override
public boolean isInterceptFindMany(BeanQueryRequest<?> request) {
return false;
}
@Override
public <T> BeanCollection<T> findMany(BeanQueryRequest<T> request) {
return null;
}
}