Refactor ebean-core internal API - getters -> accessors

This commit is contained in:
Rob Bygrave
2023-06-02 09:03:29 +12:00
parent 2929483b0d
commit d27d20dd1c
28 changed files with 75 additions and 148 deletions
@@ -889,7 +889,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
public <T> DtoQuery<T> createNamedDtoQuery(Class<T> dtoType, String namedQuery) {
DtoBeanDescriptor<T> descriptor = dtoBeanManager.descriptor(dtoType);
String sql = descriptor.getNamedRawSql(namedQuery);
String sql = descriptor.namedRawSql(namedQuery);
if (sql == null) {
throw new PersistenceException("No named query called " + namedQuery + " for bean:" + dtoType.getName());
}
@@ -53,9 +53,9 @@ public final class DtoQueryRequest<T> extends AbstractSqlQueryRequest {
query.setCancelableQuery(ormQuery);
// execute the underlying ORM query returning the ResultSet
SpiResultSet result = server.findResultSet(ormQuery, transaction);
this.pstmt = result.getStatement();
this.pstmt = result.statement();
this.sql = ormQuery.getGeneratedSql();
setResultSet(result.getResultSet(), ormQuery.queryPlanKey());
setResultSet(result.resultSet(), ormQuery.queryPlanKey());
} else {
// native SQL query execution
@@ -41,22 +41,22 @@ final class MultiTenantDbCatalogSupplier implements DataSourceSupplier {
}
@Override
public DataSource getDataSource() {
public DataSource dataSource() {
return catalogDataSource;
}
@Override
public DataSource getReadOnlyDataSource() {
public DataSource readOnlyDataSource() {
return readOnly;
}
@Override
public Connection getConnection(Object tenantId) throws SQLException {
public Connection connection(Object tenantId) throws SQLException {
return catalogDataSource.getConnectionForTenant(tenantId);
}
@Override
public Connection getReadOnlyConnection(Object tenantId) throws SQLException {
public Connection readOnlyConnection(Object tenantId) throws SQLException {
return readOnly.getConnectionForTenant(tenantId);
}
@@ -41,22 +41,22 @@ final class MultiTenantDbSchemaSupplier implements DataSourceSupplier {
}
@Override
public DataSource getDataSource() {
public DataSource dataSource() {
return schemaDataSource;
}
@Override
public DataSource getReadOnlyDataSource() {
public DataSource readOnlyDataSource() {
return readOnly;
}
@Override
public Connection getConnection(Object tenantId) throws SQLException {
public Connection connection(Object tenantId) throws SQLException {
return schemaDataSource.getConnectionForTenant(tenantId);
}
@Override
public Connection getReadOnlyConnection(Object tenantId) throws SQLException {
public Connection readOnlyConnection(Object tenantId) throws SQLException {
return readOnly.getConnectionForTenant(tenantId);
}
@@ -27,23 +27,23 @@ final class MultiTenantDbSupplier implements DataSourceSupplier {
}
@Override
public DataSource getReadOnlyDataSource() {
public DataSource readOnlyDataSource() {
// read only datasource not supported with DB per tenant at this stage
return null;
}
@Override
public DataSource getDataSource() {
public DataSource dataSource() {
return dataSourceProvider.dataSource(tenantProvider.currentId());
}
@Override
public Connection getConnection(Object tenantId) throws SQLException {
public Connection connection(Object tenantId) throws SQLException {
return dataSourceProvider.dataSource(tenantId).getConnection();
}
@Override
public Connection getReadOnlyConnection(Object tenantId) throws SQLException {
public Connection readOnlyConnection(Object tenantId) throws SQLException {
throw new SQLException("Not currently supported");
}
@@ -547,7 +547,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
* <p>
* Takes into account the class type and id value.
*/
private Integer getBeanHash() {
private Integer beanHash() {
if (beanHash == null) {
Object id = beanDescriptor.getId(entityBean);
int hc = 92821 * bean.getClass().getName().hashCode();
@@ -560,7 +560,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
}
public void registerDeleteBean() {
Integer hash = getBeanHash();
Integer hash = beanHash();
transaction.registerDeleteBean(hash);
}
@@ -568,7 +568,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
if (transaction == null) {
return false;
} else {
Integer hash = getBeanHash();
Integer hash = beanHash();
return transaction.isRegisteredDeleteBean(hash);
}
}
@@ -712,7 +712,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
/**
* Return the original / old value for the given property.
*/
public Object getOrigValue(BeanProperty prop) {
public Object origValue(BeanProperty prop) {
return intercept.origValue(prop.propertyIndex());
}
@@ -1360,7 +1360,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
* Set an orphan bean that needs to be deleted AFTER the request has persisted.
*/
public void setImportedOrphanForRemoval(BeanPropertyAssocOne<?> prop) {
Object orphan = getOrigValue(prop);
Object orphan = origValue(prop);
if (orphan instanceof EntityBean) {
orphanBean = (EntityBean) orphan;
}
@@ -1373,7 +1373,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
/**
* Return the SQL used to fetch the last inserted id value.
*/
public String getSelectLastInsertedId() {
public String selectLastInsertedId() {
return beanDescriptor.selectLastInsertedId(publish);
}
@@ -30,7 +30,7 @@ public final class RelationalQueryRequest extends AbstractSqlQueryRequest {
@Override
protected void setResultSet(ResultSet resultSet, Object planKey) throws SQLException {
this.resultSet = resultSet;
this.propertyNames = getPropertyNames();
this.propertyNames = propertyNames();
// calculate the initialCapacity of the Map to reduce rehashing
float initCap = (propertyNames.length) / 0.7f;
this.estimateCapacity = (int) initCap + 1;
@@ -95,7 +95,7 @@ public final class RelationalQueryRequest extends AbstractSqlQueryRequest {
/**
* Build the list of property names.
*/
private String[] getPropertyNames() throws SQLException {
private String[] propertyNames() throws SQLException {
ResultSetMetaData metaData = resultSet.getMetaData();
int columnsPlusOne = metaData.getColumnCount() + 1;
ArrayList<String> propNames = new ArrayList<>(columnsPlusOne - 1);
@@ -127,7 +127,7 @@ public final class RelationalQueryRequest extends AbstractSqlQueryRequest {
}
}
public ResultSet getResultSet() {
public ResultSet resultSet() {
return resultSet;
}
@@ -26,22 +26,22 @@ final class SimpleDataSourceProvider implements DataSourceSupplier {
}
@Override
public DataSource getDataSource() {
public DataSource dataSource() {
return dataSource;
}
@Override
public DataSource getReadOnlyDataSource() {
public DataSource readOnlyDataSource() {
return readOnlyDataSource;
}
@Override
public Connection getConnection(Object tenantId) throws SQLException {
public Connection connection(Object tenantId) throws SQLException {
return dataSource.getConnection();
}
@Override
public Connection getReadOnlyConnection(Object tenantId) throws SQLException {
public Connection readOnlyConnection(Object tenantId) throws SQLException {
return readOnlyDataSource.getConnection();
}
@@ -19,11 +19,11 @@ public final class SpiResultSet {
this.resultSet = resultSet;
}
public PreparedStatement getStatement() {
public PreparedStatement statement() {
return statement;
}
public ResultSet getResultSet() {
public ResultSet resultSet() {
return resultSet;
}
}
@@ -2355,7 +2355,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
ElPropertyDeploy fk = elDeployCache.get(propName);
if (fk instanceof BeanFkeyProperty) {
// propertyDeploy chain for foreign key column
return ((BeanFkeyProperty) fk).create(chain.getExpression(), chain.isContainsMany());
return ((BeanFkeyProperty) fk).create(chain.expression(), chain.isContainsMany());
}
}
int basePos = propName.indexOf('.');
@@ -2375,7 +2375,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
return property;
}
if (property == null) {
throw new PersistenceException("No property found for [" + propName + "] in expression " + chain.getExpression());
throw new PersistenceException("No property found for [" + propName + "] in expression " + chain.expression());
}
if (property.containsMany()) {
chain.setContainsMany();
@@ -46,7 +46,7 @@ public final class DtoBeanDescriptor<T> {
/**
* Return the named RawSql query.
*/
public String getNamedRawSql(String name) {
public String namedRawSql(String name) {
return namedQueries.get(name);
}
@@ -20,7 +20,6 @@ public final class ElComparatorCompound<T> implements Comparator<T>, ElComparato
@Override
public int compare(T o1, T o2) {
for (ElComparator<T> anArray : array) {
int ret = anArray.compare(o1, o2);
if (ret != 0) {
@@ -33,14 +32,12 @@ public final class ElComparatorCompound<T> implements Comparator<T>, ElComparato
@Override
public int compareValue(Object value, T o2) {
for (ElComparator<T> anArray : array) {
int ret = anArray.compareValue(value, o2);
if (ret != 0) {
return ret;
}
}
return 0;
}
@@ -23,7 +23,6 @@ public final class ElComparatorProperty<T> implements Comparator<T>, ElComparato
@Override
public int compare(T o1, T o2) {
Object val1 = elGetValue.pathGet(o1);
Object val2 = elGetValue.pathGet(o2);
return compareValues(val1, val2);
@@ -31,14 +30,12 @@ public final class ElComparatorProperty<T> implements Comparator<T>, ElComparato
@Override
public int compareValue(Object value, T o2) {
Object val2 = elGetValue.pathGet(o2);
return compareValues(value, val2);
}
@SuppressWarnings({"unchecked", "rawtypes"})
public int compareValues(Object val1, Object val2) {
if (val1 == null) {
return val2 == null ? 0 : nullOrder;
}
@@ -55,5 +52,4 @@ public final class ElComparatorProperty<T> implements Comparator<T>, ElComparato
return asc * c.compareTo(val2);
}
}
@@ -30,13 +30,11 @@ public final class ElFilter<T> implements Filter<T> {
return elGetValue.convert(value);
}
private ElComparator<T> getElComparator(String propertyName) {
private ElComparator<T> elComparator(String propertyName) {
return beanDescriptor.elComparator(propertyName);
}
private ElPropertyValue getElGetValue(String propertyName) {
private ElPropertyValue elGetValue(String propertyName) {
return beanDescriptor.elGetValue(propertyName);
}
@@ -55,119 +53,80 @@ public final class ElFilter<T> implements Filter<T> {
return true;
}
@Override
public Filter<T> in(String propertyName, Set<?> matchingValues) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.InSet<>(matchingValues, elGetValue));
matches.add(new ElMatchBuilder.InSet<>(matchingValues, elGetValue(propertyName)));
return this;
}
@Override
public Filter<T> eq(String propertyName, Object value) {
value = convertValue(propertyName, value);
ElComparator<T> comparator = getElComparator(propertyName);
matches.add(new ElMatchBuilder.Eq<>(value, comparator));
matches.add(new ElMatchBuilder.Eq<>(value, elComparator(propertyName)));
return this;
}
@Override
public Filter<T> ne(String propertyName, Object value) {
value = convertValue(propertyName, value);
ElComparator<T> comparator = getElComparator(propertyName);
matches.add(new ElMatchBuilder.Ne<>(value, comparator));
matches.add(new ElMatchBuilder.Ne<>(value, elComparator(propertyName)));
return this;
}
@Override
public Filter<T> between(String propertyName, Object min, Object max) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
ElPropertyValue elGetValue = elGetValue(propertyName);
min = elGetValue.convert(min);
max = elGetValue.convert(max);
ElComparator<T> elComparator = getElComparator(propertyName);
matches.add(new ElMatchBuilder.Between<>(min, max, elComparator));
matches.add(new ElMatchBuilder.Between<>(min, max, elComparator(propertyName)));
return this;
}
@Override
public Filter<T> gt(String propertyName, Object value) {
value = convertValue(propertyName, value);
ElComparator<T> comparator = getElComparator(propertyName);
matches.add(new ElMatchBuilder.Gt<>(value, comparator));
matches.add(new ElMatchBuilder.Gt<>(value, elComparator(propertyName)));
return this;
}
@Override
public Filter<T> ge(String propertyName, Object value) {
value = convertValue(propertyName, value);
ElComparator<T> comparator = getElComparator(propertyName);
matches.add(new ElMatchBuilder.Ge<>(value, comparator));
matches.add(new ElMatchBuilder.Ge<>(value, elComparator(propertyName)));
return this;
}
@Override
public Filter<T> ieq(String propertyName, String value) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.Ieq<>(elGetValue, value));
matches.add(new ElMatchBuilder.Ieq<>(elGetValue(propertyName), value));
return this;
}
@Override
public Filter<T> isNotNull(String propertyName) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.IsNotNull<>(elGetValue));
matches.add(new ElMatchBuilder.IsNotNull<>(elGetValue(propertyName)));
return this;
}
@Override
public Filter<T> isNull(String propertyName) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.IsNull<>(elGetValue));
matches.add(new ElMatchBuilder.IsNull<>(elGetValue(propertyName)));
return this;
}
@Override
public Filter<T> le(String propertyName, Object value) {
value = convertValue(propertyName, value);
ElComparator<T> comparator = getElComparator(propertyName);
matches.add(new ElMatchBuilder.Le<>(value, comparator));
matches.add(new ElMatchBuilder.Le<>(value, elComparator(propertyName)));
return this;
}
@Override
public Filter<T> lt(String propertyName, Object value) {
value = convertValue(propertyName, value);
ElComparator<T> comparator = getElComparator(propertyName);
matches.add(new ElMatchBuilder.Lt<>(value, comparator));
matches.add(new ElMatchBuilder.Lt<>(value, elComparator(propertyName)));
return this;
}
@@ -176,63 +135,45 @@ public final class ElFilter<T> implements Filter<T> {
}
public Filter<T> regex(String propertyName, String regEx, int options) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue, regEx, options));
matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue(propertyName), regEx, options));
return this;
}
@Override
public Filter<T> contains(String propertyName, String value) {
String quote = ".*" + Pattern.quote(value) + ".*";
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue, quote, 0));
matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue(propertyName), quote, 0));
return this;
}
@Override
public Filter<T> icontains(String propertyName, String value) {
String quote = ".*" + Pattern.quote(value) + ".*";
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue, quote, Pattern.CASE_INSENSITIVE));
matches.add(new ElMatchBuilder.RegularExpr<>(elGetValue(propertyName), quote, Pattern.CASE_INSENSITIVE));
return this;
}
@Override
public Filter<T> endsWith(String propertyName, String value) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.EndsWith<>(elGetValue, value));
matches.add(new ElMatchBuilder.EndsWith<>(elGetValue(propertyName), value));
return this;
}
@Override
public Filter<T> startsWith(String propertyName, String value) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.StartsWith<>(elGetValue, value));
matches.add(new ElMatchBuilder.StartsWith<>(elGetValue(propertyName), value));
return this;
}
@Override
public Filter<T> iendsWith(String propertyName, String value) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.IEndsWith<>(elGetValue, value));
matches.add(new ElMatchBuilder.IEndsWith<>(elGetValue(propertyName), value));
return this;
}
@Override
public Filter<T> istartsWith(String propertyName, String value) {
ElPropertyValue elGetValue = getElGetValue(propertyName);
matches.add(new ElMatchBuilder.IStartsWith<>(elGetValue, value));
matches.add(new ElMatchBuilder.IStartsWith<>(elGetValue(propertyName), value));
return this;
}
@@ -244,7 +185,6 @@ public final class ElFilter<T> implements Filter<T> {
@Override
public List<T> filter(List<T> list) {
if (sortByClause != null) {
// create shallow copy and sort
list = new ArrayList<>(list);
@@ -252,7 +192,6 @@ public final class ElFilter<T> implements Filter<T> {
}
ArrayList<T> filterList = new ArrayList<>();
for (T t : list) {
if (isMatch(t)) {
filterList.add(t);
@@ -261,7 +200,6 @@ public final class ElFilter<T> implements Filter<T> {
}
}
}
return filterList;
}
@@ -76,7 +76,6 @@ final class ElMatchBuilder {
@Override
public boolean isMatch(T bean) {
String v = (String) elGetValue.pathGet(bean);
return charMatch.startsWith(v);
}
@@ -97,7 +96,6 @@ final class ElMatchBuilder {
@Override
public boolean isMatch(T bean) {
String v = (String) elGetValue.pathGet(bean);
return charMatch.endsWith(v);
}
@@ -67,8 +67,8 @@ public final class ElPropertyChain implements ElPropertyValue {
this.scalarType = null;
}
this.lastElPropertyValue = chain[chain.length - 1];
this.placeHolder = getElPlaceHolder(prefix, lastElPropertyValue, false);
this.placeHolderEncrypted = getElPlaceHolder(prefix, lastElPropertyValue, true);
this.placeHolder = placeHolder(prefix, lastElPropertyValue, false);
this.placeHolderEncrypted = placeHolder(prefix, lastElPropertyValue, true);
}
@Override
@@ -86,7 +86,7 @@ public final class ElPropertyChain implements ElPropertyValue {
return false;
}
private String getElPlaceHolder(String prefix, ElPropertyValue lastElPropertyValue, boolean encrypted) {
private String placeHolder(String prefix, ElPropertyValue lastElPropertyValue, boolean encrypted) {
if (prefix == null) {
return lastElPropertyValue.elPlaceholder(encrypted);
}
@@ -36,7 +36,7 @@ public final class ElPropertyChainBuilder {
this.containsMany = true;
}
public String getExpression() {
public String expression() {
return expression;
}
@@ -206,7 +206,6 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
*/
@Override
public void addSql(SpiExpressionRequest request) {
if (list.isEmpty()) {
request.append(SQL_TRUE);
} else {
@@ -270,7 +269,6 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
* Add expressions to the list for all the non-null properties (and do this recursively).
*/
private void addExpressions(ArrayList<SpiExpression> list, BeanDescriptor<?> beanDescriptor, EntityBean bean, String prefix) {
for (BeanProperty beanProperty : beanDescriptor.propertiesAll()) {
if (!beanProperty.isTransient()) {
@@ -1077,7 +1077,7 @@ public final class DefaultPersister implements Persister {
}
private void deleteOrphan(PersistRequestBean<?> request, BeanPropertyAssocOne<?> prop) {
Object origValue = request.getOrigValue(prop);
Object origValue = request.origValue(prop);
if (origValue instanceof EntityBean) {
delete((EntityBean) origValue, request.transaction(), false);
}
@@ -148,7 +148,7 @@ public final class InsertHandler extends DmlHandler {
PreparedStatement stmt = null;
ResultSet rset = null;
try {
stmt = transaction.connection().prepareStatement(persistRequest.getSelectLastInsertedId());
stmt = transaction.connection().prepareStatement(persistRequest.selectLastInsertedId());
rset = stmt.executeQuery();
setGeneratedKey(rset);
} finally {
@@ -130,7 +130,7 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine
ScalarType<T> scalarType = (ScalarType<T>) binder.getScalarType(cls);
try {
request.executeSql(binder, SpiQuery.Type.ATTRIBUTE);
final DataReader dataReader = binder.createDataReader(request.getResultSet());
final DataReader dataReader = binder.createDataReader(request.resultSet());
T value = null;
if (dataReader.next()) {
value = scalarType.read(dataReader);
@@ -152,7 +152,7 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine
ScalarType<T> scalarType = (ScalarType<T>) binder.getScalarType(cls);
try {
request.executeSql(binder, SpiQuery.Type.ATTRIBUTE);
final DataReader dataReader = binder.createDataReader(request.getResultSet());
final DataReader dataReader = binder.createDataReader(request.resultSet());
List<T> rows = new ArrayList<>();
while (dataReader.next()) {
rows.add(scalarType.read(dataReader));
@@ -174,7 +174,7 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine
ScalarType<T> scalarType = (ScalarType<T>) binder.getScalarType(cls);
try {
request.executeSql(binder, SpiQuery.Type.ATTRIBUTE);
final DataReader dataReader = binder.createDataReader(request.getResultSet());
final DataReader dataReader = binder.createDataReader(request.resultSet());
while (dataReader.next()) {
consumer.accept(scalarType.read(dataReader));
}
@@ -17,7 +17,7 @@ public interface DataSourceSupplier {
* <p>
* This should take into account multi-tenancy and the current tenantId.
*/
DataSource getDataSource();
DataSource dataSource();
/**
* Return the read only DataSource to use for the current request.
@@ -25,7 +25,7 @@ public interface DataSourceSupplier {
* This can return null meaning that no read only DataSource (with autoCommit)
* is available for use so normal transactions with explicit commit should be used.
*/
DataSource getReadOnlyDataSource();
DataSource readOnlyDataSource();
/**
* Obtain the current TenantId *IF* it is required for the DataSource.
@@ -38,7 +38,7 @@ public interface DataSourceSupplier {
* @param tenantId Most often null but well supplied indicates a multi-tenant lazy loading query
* @return the connection to use
*/
Connection getConnection(Object tenantId) throws SQLException;
Connection connection(Object tenantId) throws SQLException;
/**
* Return a connection from the read only DataSource taking into account a tenantId for multi-tenant lazy loading.
@@ -46,7 +46,7 @@ public interface DataSourceSupplier {
* @param tenantId Most often null but well supplied indicates a multi-tenant lazy loading query
* @return the connection to use
*/
Connection getReadOnlyConnection(Object tenantId) throws SQLException;
Connection readOnlyConnection(Object tenantId) throws SQLException;
/**
* Shutdown the datasource de-registering the JDBC driver if requested.
@@ -17,7 +17,7 @@ class TransactionFactoryBasic extends TransactionFactory {
TransactionFactoryBasic(TransactionManager manager, DataSourceSupplier dataSourceSupplier) {
super(manager);
this.dataSource = dataSourceSupplier.getDataSource();
this.dataSource = dataSourceSupplier.dataSource();
}
@Override
@@ -22,7 +22,7 @@ final class TransactionFactoryBasicWithRead extends TransactionFactoryBasic {
TransactionFactoryBasicWithRead(TransactionManager manager, DataSourceSupplier dataSourceSupplier) {
super(manager, dataSourceSupplier);
this.readOnlyDataSource = dataSourceSupplier.getReadOnlyDataSource();
this.readOnlyDataSource = dataSourceSupplier.readOnlyDataSource();
}
@Override
@@ -12,7 +12,7 @@ final class TransactionFactoryBuilder {
*/
static TransactionFactory build(TransactionManager manager, DataSourceSupplier dataSourceSupplier, CurrentTenantProvider tenantProvider) {
boolean hasReadOnlyDataSource = dataSourceSupplier.getReadOnlyDataSource() != null;
boolean hasReadOnlyDataSource = dataSourceSupplier.readOnlyDataSource() != null;
if (tenantProvider == null) {
if (hasReadOnlyDataSource) {
return new TransactionFactoryBasicWithRead(manager, dataSourceSupplier);
@@ -41,7 +41,7 @@ class TransactionFactoryTenant extends TransactionFactory {
// tenantId not set (by lazy loading) so get current tenantId
tenantId = tenantProvider.currentId();
}
connection = dataSourceSupplier.getConnection(tenantId);
connection = dataSourceSupplier.connection(tenantId);
SpiTransaction transaction = manager.createTransaction(explicit, connection);
transaction.setTenantId(tenantId);
return transaction;
@@ -30,7 +30,7 @@ final class TransactionFactoryTenantWithRead extends TransactionFactoryTenant {
// obtain the tenantId if the DataSource requires it
tenantId = dataSourceSupplier.currentTenantId();
}
connection = dataSourceSupplier.getReadOnlyConnection(tenantId);
connection = dataSourceSupplier.readOnlyConnection(tenantId);
return new ImplicitReadOnlyTransaction(manager, connection, tenantId);
} catch (PersistenceException ex) {
JdbcClose.close(connection);
@@ -248,17 +248,17 @@ public class TransactionManager implements SpiTransactionManager {
@Override
public final Connection queryPlanConnection() throws SQLException {
return dataSourceSupplier.getConnection(null);
return dataSourceSupplier.connection(null);
}
@Override
public final DataSource dataSource() {
return dataSourceSupplier.getDataSource();
return dataSourceSupplier.dataSource();
}
@Override
public final DataSource readOnlyDataSource() {
return dataSourceSupplier.getReadOnlyDataSource();
return dataSourceSupplier.readOnlyDataSource();
}
/**