Refactor ebean-core internal API - getters -> accessors

This commit is contained in:
Rob Bygrave
2023-06-01 22:05:53 +12:00
parent 2ab7c3529a
commit 2929483b0d
104 changed files with 545 additions and 557 deletions
@@ -40,14 +40,14 @@ public final class BeanCacheResult<T> {
/**
* Return the natural key or id value.
*/
public Object getKey() {
public Object key() {
return key;
}
/**
* Return the bean.
*/
public T getBean() {
public T bean() {
return bean;
}
}
@@ -107,13 +107,13 @@ public final class BindParams implements Serializable {
/**
* Return a Natural Key bind param if supported.
*/
public NaturalKeyBindParam getNaturalKeyBindParam() {
public NaturalKeyBindParam naturalKeyBindParam() {
if (!positionedParameters.isEmpty()) {
return null;
}
if (namedParameters.size() == 1) {
Entry<String, Param> e = namedParameters.entrySet().iterator().next();
return new NaturalKeyBindParam(e.getKey(), e.getValue().getInValue());
return new NaturalKeyBindParam(e.getKey(), e.getValue().inValue());
}
return null;
}
@@ -135,7 +135,7 @@ public final class BindParams implements Serializable {
* Set a null parameter using position.
*/
public void setNullParameter(int position, int jdbcType) {
Param p = getParam(position);
Param p = parameter(position);
p.setInNullType(jdbcType);
}
@@ -143,7 +143,7 @@ public final class BindParams implements Serializable {
* Set an In Out parameter using position.
*/
public void setParameter(int position, Object value, int outType) {
Param p = getParam(position);
Param p = parameter(position);
p.setInValue(value);
p.setOutType(outType);
}
@@ -168,7 +168,7 @@ public final class BindParams implements Serializable {
@SuppressWarnings("rawtypes")
public void setParameter(int position, Object value) {
//TODO: Review - assert value != null : "use setNullParameter";
Param p = getParam(position);
Param p = parameter(position);
if (value instanceof Collection) {
// use of postgres ANY with positioned parameter
value = new MultiValueWrapper((Collection)value);
@@ -180,15 +180,21 @@ public final class BindParams implements Serializable {
* Register the parameter as an Out parameter using position.
*/
public void registerOut(int position, int outType) {
Param p = getParam(position);
Param p = parameter(position);
p.setOutType(outType);
}
private Param getParam(String name) {
/**
* Return the named parameter.
*/
public Param parameter(String name) {
return namedParameters.computeIfAbsent(name, k -> new Param());
}
private Param getParam(int position) {
/**
* Return the Parameter for a given position.
*/
public Param parameter(int position) {
int more = position - positionedParameters.size();
if (more > 0) {
for (int i = 0; i < more; i++) {
@@ -202,7 +208,7 @@ public final class BindParams implements Serializable {
* Set a named In Out parameter.
*/
public void setParameter(String name, Object value, int outType) {
Param p = getParam(name);
Param p = parameter(name);
p.setInValue(value);
p.setOutType(outType);
}
@@ -211,7 +217,7 @@ public final class BindParams implements Serializable {
* Set a named In parameter that is null.
*/
public void setNullParameter(String name, int jdbcType) {
Param p = getParam(name);
Param p = parameter(name);
p.setInNullType(jdbcType);
}
@@ -220,7 +226,7 @@ public final class BindParams implements Serializable {
*/
public Param setParameter(String name, Object value) {
// TODO: Review - assert value != null : "use setNullParameter";
Param p = getParam(name);
Param p = parameter(name);
p.setInValue(value);
return p;
}
@@ -229,7 +235,7 @@ public final class BindParams implements Serializable {
* Set a named In parameter that is multi-valued.
*/
public void setArrayParameter(String name, Collection<?> value) {
Param p = getParam(name);
Param p = parameter(name);
p.setInValue(new MultiValueWrapper(value));
}
@@ -240,7 +246,7 @@ public final class BindParams implements Serializable {
* </p>
*/
public Param setEncryptionKey(String name, Object value) {
Param p = getParam(name);
Param p = parameter(name);
p.setEncryptionKey(value);
return p;
}
@@ -249,25 +255,10 @@ public final class BindParams implements Serializable {
* Register the named parameter as an Out parameter.
*/
public void registerOut(String name, int outType) {
Param p = getParam(name);
Param p = parameter(name);
p.setOutType(outType);
}
/**
* Return the Parameter for a given position.
*/
public Param getParameter(int position) {
// Used to read Out value by CallableSql
return getParam(position);
}
/**
* Return the named parameter.
*/
public Param getParameter(String name) {
return getParam(name);
}
/**
* Return the values of ordered parameters.
*/
@@ -286,7 +277,7 @@ public final class BindParams implements Serializable {
* Return the sql with ? place holders (named parameters have been processed
* and ordered).
*/
public String getPreparedSql() {
public String preparedSql() {
return preparedSql;
}
@@ -457,7 +448,7 @@ public final class BindParams implements Serializable {
* Return the jdbc type of this parameter. Used for registering Out
* parameters and setting NULL In parameters.
*/
public int getType() {
public int type() {
return type;
}
@@ -500,7 +491,7 @@ public final class BindParams implements Serializable {
* Return the OUT value that was retrieved. This value is set after
* CallableStatement was executed.
*/
public Object getOutValue() {
public Object outValue() {
return outValue;
}
@@ -508,7 +499,7 @@ public final class BindParams implements Serializable {
* Return the In value. If this is null, then the type should be used to
* specify the type of the null.
*/
public Object getInValue() {
public Object inValue() {
return inValue;
}
@@ -37,8 +37,8 @@ public final class CacheIdLookupMany<T> implements CacheIdLookup<T> {
Set<Object> hitIds = new HashSet<>();
List<T> beans = new ArrayList<>();
for (BeanCacheResult.Entry<T> hit : cacheResult.hits()) {
hitIds.add(hit.getKey());
beans.add(hit.getBean());
hitIds.add(hit.key());
beans.add(hit.bean());
}
this.remaining = idInExpression.removeIds(hitIds);
return beans;
@@ -26,7 +26,7 @@ public final class CacheIdLookupSingle<T> implements CacheIdLookup<T> {
final List<BeanCacheResult.Entry<T>> hits = cacheResult.hits();
if (hits.size() == 1) {
found = true;
return Collections.singletonList(hits.get(0).getBean());
return Collections.singletonList(hits.get(0).bean());
}
return Collections.emptyList();
}
@@ -31,14 +31,14 @@ public final class ExtraMetrics {
/**
* Timed metric for bind capture used with query plan collection.
*/
public TimedMetric getBindCapture() {
public TimedMetric bindCapture() {
return bindCapture;
}
/**
* Timed metric for query plan collection.
*/
public TimedMetric getPlanCollect() {
public TimedMetric planCollect() {
return planCollect;
}
@@ -90,7 +90,7 @@ public final class LoadManyRequest extends LoadRequest {
SpiQuery<?> query = many.newQuery(server);
String orderBy = many.lazyFetchOrderBy();
if (orderBy != null) {
query.order(orderBy);
query.orderBy(orderBy);
}
String extraWhere = many.extraWhere();
if (extraWhere != null) {
@@ -45,6 +45,6 @@ public abstract class LoadRequest {
* So one of - findIterate(), findEach(), findEachWhile() or findVisit().
*/
public boolean isParentFindIterate() {
return parentRequest != null && parentRequest.query().getType() == SpiQuery.Type.ITERATE;
return parentRequest != null && parentRequest.query().type() == SpiQuery.Type.ITERATE;
}
}
@@ -102,17 +102,17 @@ public final class ManyWhereJoins implements Serializable {
/**
* Return the set of many where joins.
*/
public Collection<PropertyJoin> getPropertyJoins() {
public Collection<PropertyJoin> propertyJoins() {
return joins.values();
}
/**
* Return the set of property names for the many where joins.
*/
public TreeSet<String> getPropertyNames() {
public TreeSet<String> propertyNames() {
TreeSet<String> propertyNames = new TreeSet<>();
for (PropertyJoin join : joins.values()) {
propertyNames.add(join.getProperty());
propertyNames.add(join.property());
}
return propertyNames;
}
@@ -138,7 +138,7 @@ public final class ManyWhereJoins implements Serializable {
/**
* Return the formula properties to build the select clause for a findCount query.
*/
public List<String> getFormulaJoinProperties(String prefix) {
public List<String> formulaJoinProperties(String prefix) {
return formulaJoinProperties.get(prefix);
}
@@ -13,5 +13,5 @@ public interface NaturalKeyEntry {
/**
* Return the inValue (used to remove from IN clause of original query).
*/
Object getInValue();
Object inValue();
}
@@ -67,7 +67,7 @@ final class NaturalKeyEntryBasic implements NaturalKeyEntry {
}
@Override
public Object getInValue() {
public Object inValue() {
return inValue;
}
}
@@ -16,7 +16,7 @@ final class NaturalKeyEntrySimple implements NaturalKeyEntry {
}
@Override
public Object getInValue() {
public Object inValue() {
return val;
}
}
@@ -189,14 +189,13 @@ public final class NaturalKeyQueryData<T> {
* Adjust the IN clause removing the hit entry.
*/
public List<T> removeHits(BeanCacheResult<T> cacheResult) {
List<BeanCacheResult.Entry<T>> hits = cacheResult.hits();
this.hitCount = hits.size();
List<T> beans = new ArrayList<>(hitCount);
for (BeanCacheResult.Entry<T> hit : hits) {
removeKey(set.getInValue(hit.getKey()));
beans.add(hit.getBean());
removeKey(set.inValue(hit.key()));
beans.add(hit.bean());
}
return beans;
}
@@ -23,7 +23,7 @@ public final class NaturalKeySet {
return map.keySet();
}
Object getInValue(Object naturalKey) {
return map.get(naturalKey).getInValue();
Object inValue(Object naturalKey) {
return map.get(naturalKey).inValue();
}
}
@@ -18,14 +18,14 @@ public final class PropertyJoin {
/**
* Return the property that should be joined.
*/
public String getProperty() {
public String property() {
return property;
}
/**
* Return true if this join is required to be an outer join.
*/
public SqlJoinType getSqlJoinType() {
public SqlJoinType sqlJoinType() {
return joinType;
}
@@ -4,7 +4,7 @@ import io.ebean.CallableSql;
public interface SpiCallableSql extends CallableSql {
BindParams getBindParams();
BindParams bindParams();
TransactionEventTable getTransactionEventTable();
TransactionEventTable transactionEventTable();
}
@@ -19,7 +19,7 @@ public interface SpiDtoQuery<T> extends DtoQuery<T>, SpiSqlBinding {
/**
* Get the query plan for the cache.
*/
DtoQueryPlan getQueryPlan(Object planKey);
DtoQueryPlan queryPlan(Object planKey);
/**
* Build the query plan.
@@ -39,7 +39,7 @@ public interface SpiDtoQuery<T> extends DtoQuery<T>, SpiSqlBinding {
/**
* Return the label with fallback to profile location label.
*/
String getPlanLabel();
String planLabel();
/**
* Obtain the location if necessary.
@@ -49,21 +49,21 @@ public interface SpiDtoQuery<T> extends DtoQuery<T>, SpiSqlBinding {
/**
* Return the profile location.
*/
ProfileLocation getProfileLocation();
ProfileLocation profileLocation();
/**
* Return the associated DTO bean type.
*/
Class<T> getType();
Class<T> type();
/**
* Return an underlying ORM query (if this query is built from an ORM query).
*/
SpiQuery<?> getOrmQuery();
SpiQuery<?> ormQuery();
/**
* Return the explicit transaction used to execute the query.
*/
Transaction getTransaction();
Transaction transaction();
}
@@ -20,7 +20,7 @@ public interface SpiExpressionList<T> extends ExpressionList<T>, SpiExpression {
/**
* Return the underlying list of expressions.
*/
List<SpiExpression> getUnderlyingList();
List<SpiExpression> underlyingList();
/**
* Return a copy of the ExpressionList with the path trimmed for filterMany() expressions.
@@ -29,7 +29,7 @@ public final class SpiExpressionValidation {
/**
* Return the set of properties considered as having unknown paths.
*/
public Set<String> getUnknownProperties() {
public Set<String> unknownProperties() {
return unknown;
}
@@ -206,7 +206,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
* Return the mode of the query of if null return CURRENT mode.
*/
public static TemporalMode of(SpiQuery<?> query) {
return (query != null) ? query.getTemporalMode() : TemporalMode.CURRENT;
return (query != null) ? query.temporalMode() : TemporalMode.CURRENT;
}
}
@@ -218,22 +218,22 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the id used to identify a particular query for the given bean type.
*/
String getProfileId();
String profileId();
/**
* Return the profile location for this query.
*/
ProfileLocation getProfileLocation();
ProfileLocation profileLocation();
/**
* Return the label set on the query.
*/
String getLabel();
String label();
/**
* Return the label manually set on the query or from the profile location.
*/
String getPlanLabel();
String planLabel();
/**
* Return true if this is a "find by id" query. This includes a check for a single "equal to" expression for the Id.
@@ -258,7 +258,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the unmodified native sql query (with named params etc).
*/
String getNativeSql();
String nativeSql();
/**
* Return the ForUpdate mode.
@@ -269,17 +269,17 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the bean descriptor for this query.
*/
BeanDescriptor<T> getBeanDescriptor();
BeanDescriptor<T> descriptor();
/**
* Return the query plan key.
*/
Object getQueryPlanKey();
Object queryPlanKey();
/**
* Return the RawSql that was set to use for this query.
*/
SpiRawSql getRawSql();
SpiRawSql rawSql();
/**
* Return true if this query should be executed against the doc store.
@@ -298,7 +298,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
* This can be null and in that case use the default scope.
* </p>
*/
PersistenceContextScope getPersistenceContextScope();
PersistenceContextScope persistenceContextScope();
/**
* Return the origin key.
@@ -308,7 +308,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the default lazy load batch size.
*/
int getLazyLoadBatchSize();
int lazyLoadBatchSize();
/**
* Return true if select all properties was used to ensure the property
@@ -339,12 +339,12 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the query mode.
*/
Mode getMode();
Mode mode();
/**
* Return the Temporal mode for the query.
*/
TemporalMode getTemporalMode();
TemporalMode temporalMode();
/**
* Return true if this is a find versions between query.
@@ -354,12 +354,12 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the find versions start timestamp.
*/
Timestamp getVersionStart();
Timestamp versionStart();
/**
* Return the find versions end timestamp.
*/
Timestamp getVersionEnd();
Timestamp versionEnd();
/**
* Return true if this is a 'As Of' query.
@@ -408,7 +408,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
void addSoftDeletePredicate(String softDeletePredicate);
List<String> getSoftDeletePredicates();
List<String> softDeletePredicates();
/**
* Bind the named multi-value array parameter which we would use with Postgres ANY.
@@ -431,7 +431,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the type of query (List, Set, Map, Bean, rowCount etc).
*/
Type getType();
Type type();
/**
* Set the query type (List, Set etc).
@@ -441,12 +441,12 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return a more detailed description of the lazy or query load.
*/
String getLoadDescription();
String loadDescription();
/**
* Return the load mode (+lazy or +query).
*/
String getLoadMode();
String loadMode();
/**
* This becomes a lazy loading query for a many relationship.
@@ -456,7 +456,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the lazy loading 'many' property.
*/
BeanPropertyAssocMany<?> getLazyLoadMany();
BeanPropertyAssocMany<?> lazyLoadMany();
/**
* Set the load mode (+lazy or +query) and the load description.
@@ -476,7 +476,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the joins required to support predicates on the many properties.
*/
ManyWhereJoins getManyWhereJoins();
ManyWhereJoins manyWhereJoins();
/**
* Reset AUTO mode to OFF for findList(). Expect explicit cache use with findList().
@@ -497,7 +497,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return a Natural Key bind parameter if supported by this query.
*/
NaturalKeyBindParam getNaturalKeyBindParam();
NaturalKeyBindParam naturalKeyBindParam();
/**
* Prepare the query for docstore execution with nested paths.
@@ -550,7 +550,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the tenantId to use for lazy loading.
*/
Object getTenantId();
Object tenantId();
/**
* Set the path of the many when +query/+lazy loading query is executed.
@@ -570,7 +570,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
* persistence context).
* </p>
*/
PersistenceContext getPersistenceContext();
PersistenceContext persistenceContext();
/**
* Set an explicit TransactionContext (typically for a refresh query).
@@ -598,7 +598,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
* returned this implies that profiling is turned on for this query (and all
* the objects this query creates).
*/
ProfilingListener getProfilingListener();
ProfilingListener profilingListener();
/**
* This has the effect of turning on profiling for this query.
@@ -632,7 +632,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the property that invoked lazy load.
*/
String getLazyLoadProperty();
String lazyLoadProperty();
/**
* Used to hook back a lazy loading query to the original query (query
@@ -641,7 +641,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
* This will return null or an "original" query.
* </p>
*/
ObjectGraphNode getParentNode();
ObjectGraphNode parentNode();
/**
* Return false when this is a lazy load or refresh query for a bean.
@@ -702,17 +702,17 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Can return null if no expressions where added to the where clause.
*/
SpiExpressionList<T> getWhereExpressions();
SpiExpressionList<T> whereExpressions();
/**
* Can return null if no expressions where added to the having clause.
*/
SpiExpressionList<T> getHavingExpressions();
SpiExpressionList<T> havingExpressions();
/**
* Return the text expressions.
*/
SpiExpressionList<T> getTextExpression();
SpiExpressionList<T> textExpression();
/**
* Returns true if either firstRow or maxRows has been set.
@@ -737,12 +737,12 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the cache mode for using the bean cache (Get and Put).
*/
CacheMode getUseBeanCache();
CacheMode beanCacheMode();
/**
* Return the cache mode if this query should use/check the query cache.
*/
CacheMode getUseQueryCache();
CacheMode queryCacheMode();
/**
* Return true if the beans returned by this query should be read only.
@@ -752,12 +752,12 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the query timeout.
*/
int getTimeout();
int timeout();
/**
* Return the bind parameters.
*/
BindParams getBindParams();
BindParams bindParams();
/**
* Return the bind parameters ensuring it is initialised.
@@ -793,12 +793,12 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the query detail.
*/
OrmQueryDetail getDetail();
OrmQueryDetail detail();
/**
* Return the extra join for a M2M lazy load.
*/
TableJoin getM2mIncludeJoin();
TableJoin m2mIncludeJoin();
/**
* Set the extra join for a M2M lazy load.
@@ -808,7 +808,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the property used to specify keys for a map.
*/
String getMapKey();
String mapKey();
/**
* Return the maximum number of rows to return in the query.
@@ -860,7 +860,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the hint for Statement.setFetchSize().
*/
int getBufferFetchSizeHint();
int bufferFetchSizeHint();
/**
* Return true if read auditing is disabled on this query.
@@ -886,17 +886,17 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Read the readEvent for future queries (null otherwise).
*/
ReadEvent getFutureFetchAudit();
ReadEvent futureFetchAudit();
/**
* Return the base table to use if user defined on the query.
*/
String getBaseTable();
String baseTable();
/**
* Return root table alias set by {@link #alias(String)} command.
*/
String getAlias();
String alias();
/**
* Return root table alias with default option.
@@ -911,7 +911,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Return the properties for an update query.
*/
OrmUpdateProperties getUpdateProperties();
OrmUpdateProperties updateProperties();
/**
* Simplify nested expression lists where possible.
@@ -921,7 +921,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
/**
* Returns the count distinct order setting.
*/
CountDistinctOrder getCountDistinctOrder();
CountDistinctOrder countDistinctOrder();
/**
* Handles load errors.
@@ -12,10 +12,10 @@ public interface SpiQuerySecondary {
/**
* Return a list of path/properties that are query join loaded.
*/
List<OrmQueryProperties> getQueryJoins();
List<OrmQueryProperties> queryJoins();
/**
* Return the list of path/properties that are lazy loaded.
*/
List<OrmQueryProperties> getLazyJoins();
List<OrmQueryProperties> lazyJoins();
}
@@ -7,12 +7,12 @@ public interface SpiSqlUpdate extends SqlUpdate {
/**
* Return the sql taking into account bind parameter expansion.
*/
String getBaseSql();
String baseSql();
/**
* Return the Bind parameters.
*/
BindParams getBindParams();
BindParams bindParams();
/**
* Set the final sql being executed with named parameters replaced etc.
@@ -25,8 +25,7 @@ public interface SpiTransaction extends Transaction {
/**
* Return the user defined label for the transaction.
*/
String getLabel();
String label();
/**
* Return true if generated SQL and Bind values should be logged to the
@@ -91,12 +90,12 @@ public interface SpiTransaction extends Transaction {
* Returns a String used to identify the transaction. This id is used for
* Transaction logging.
*/
String getId();
String id();
/**
* Return the start timestamp for the transaction (JVM side).
*/
long getStartNanoTime();
long startNanoTime();
/**
* Return true if this transaction has updateAllLoadedProperties set.
@@ -109,7 +108,7 @@ public interface SpiTransaction extends Transaction {
* <p>
* Returning 0 implies to use the system wide default batch size.
*/
DocStoreMode getDocStoreMode();
DocStoreMode docStoreMode();
/**
* Return the batch size to us for ElasticSearch Bulk API calls
@@ -184,7 +183,7 @@ public interface SpiTransaction extends Transaction {
* indexes. On commit the Table modifications this generates is broadcast
* around the cluster (if you have a cluster).
*/
TransactionEvent getEvent();
TransactionEvent event();
/**
* Whether persistCascade is on for save and delete.
@@ -200,7 +199,7 @@ public interface SpiTransaction extends Transaction {
/**
* Return the BatchControl used to batch up persist requests.
*/
BatchControl getBatchControl();
BatchControl batchControl();
/**
* Set the BatchControl used to batch up persist requests. There should only be one
@@ -215,7 +214,7 @@ public interface SpiTransaction extends Transaction {
* later. This is along the lines of 'extended persistence context'
* behaviour.
*/
SpiPersistenceContext getPersistenceContext();
SpiPersistenceContext persistenceContext();
/**
* Set the persistence context to this transaction.
@@ -236,7 +235,7 @@ public interface SpiTransaction extends Transaction {
* that method we can no longer trust the query only status of a
* Transaction.
*/
Connection getInternalConnection();
Connection internalConnection();
/**
* Return true if the manyToMany intersection should be persisted for this particular relationship direction.
@@ -291,7 +290,7 @@ public interface SpiTransaction extends Transaction {
/**
* Return a document store transaction.
*/
DocStoreTransaction getDocStoreTransaction();
DocStoreTransaction docStoreTransaction();
/**
* Set the current Tenant Id.
@@ -301,7 +300,7 @@ public interface SpiTransaction extends Transaction {
/**
* Return the current Tenant Id.
*/
Object getTenantId();
Object tenantId();
/**
* Return the offset time from the start of the transaction.
@@ -331,7 +330,7 @@ public interface SpiTransaction extends Transaction {
/**
* Return the profile location for this transaction.
*/
ProfileLocation getProfileLocation();
ProfileLocation profileLocation();
/**
* Return true when nested transactions should create Savepoints.
@@ -28,8 +28,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public long getStartNanoTime() {
return transaction.getStartNanoTime();
public long startNanoTime() {
return transaction.startNanoTime();
}
@Override
@@ -38,8 +38,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public String getLabel() {
return transaction.getLabel();
public String label() {
return transaction.label();
}
@Override
@@ -98,8 +98,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public ProfileLocation getProfileLocation() {
return transaction.getProfileLocation();
public ProfileLocation profileLocation() {
return transaction.profileLocation();
}
@Override
@@ -108,18 +108,18 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public Object getTenantId() {
return transaction.getTenantId();
public Object tenantId() {
return transaction.tenantId();
}
@Override
public DocStoreTransaction getDocStoreTransaction() {
return transaction.getDocStoreTransaction();
public DocStoreTransaction docStoreTransaction() {
return transaction.docStoreTransaction();
}
@Override
public DocStoreMode getDocStoreMode() {
return transaction.getDocStoreMode();
public DocStoreMode docStoreMode() {
return transaction.docStoreMode();
}
@Override
@@ -214,8 +214,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public String getId() {
return transaction.getId();
public String id() {
return transaction.id();
}
@Override
@@ -359,8 +359,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public TransactionEvent getEvent() {
return transaction.getEvent();
public TransactionEvent event() {
return transaction.event();
}
@Override
@@ -374,8 +374,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public BatchControl getBatchControl() {
return transaction.getBatchControl();
public BatchControl batchControl() {
return transaction.batchControl();
}
@Override
@@ -384,8 +384,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public SpiPersistenceContext getPersistenceContext() {
return transaction.getPersistenceContext();
public SpiPersistenceContext persistenceContext() {
return transaction.persistenceContext();
}
@Override
@@ -394,8 +394,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
}
@Override
public Connection getInternalConnection() {
return transaction.getInternalConnection();
public Connection internalConnection() {
return transaction.internalConnection();
}
@Override
@@ -41,32 +41,32 @@ public interface SpiUpdate<T> extends Update<T> {
/**
* Return the type of bean being updated.
*/
Class<?> getBeanType();
Class<?> beanType();
/**
* Return the label (for metrics collection).
*/
String getLabel();
String label();
/**
* Return the type of this - insert, update or delete.
*/
OrmUpdateType getOrmUpdateType();
OrmUpdateType ormUpdateType();
/**
* Return the name of the table being modified.
*/
String getBaseTable();
String baseTable();
/**
* Return the update statement. This could be either sql or an orm update with bean types and property names.
*/
String getUpdateStatement();
String updateStatement();
/**
* Return the timeout in seconds.
*/
int getTimeout();
int timeout();
/**
* Return true if the cache should be notified to invalidate objects.
@@ -76,7 +76,7 @@ public interface SpiUpdate<T> extends Update<T> {
/**
* Return the bind parameters.
*/
BindParams getBindParams();
BindParams bindParams();
/**
* Set the generated sql used.
@@ -36,27 +36,27 @@ public interface SpiUpdatePlan {
/**
* Return the time this plan was created.
*/
long getTimeCreated();
long timeCreated();
/**
* Return the time this plan was last used.
*/
long getTimeLastUsed();
long timeLastUsed();
/**
* Return the hash key for this plan.
*/
String getKey();
String key();
/**
* Return the concurrency mode for this plan.
*/
ConcurrencyMode getMode();
ConcurrencyMode mode();
/**
* Return the update SQL statement.
*/
String getSql();
String sql();
/**
* Return the set of bindable update properties.
@@ -55,7 +55,7 @@ public final class TransactionEvent implements Serializable {
deleteByIdMap.addList(desc, idList);
}
public DeleteByIdMap getDeleteByIdMap() {
public DeleteByIdMap deleteByIdMap() {
return deleteByIdMap;
}
@@ -70,11 +70,11 @@ public final class TransactionEvent implements Serializable {
/**
* Return the list of PersistRequestBean's for this transaction.
*/
public List<PersistRequestBean<?>> getListenerNotify() {
public List<PersistRequestBean<?>> listenerNotify() {
return listenerNotify;
}
public TransactionEventTable getEventTables() {
public TransactionEventTable eventTables() {
return eventTables;
}
@@ -129,7 +129,7 @@ public final class TransactionEvent implements Serializable {
* Add any relevant PersistRequestBean's to DocStoreUpdates for later processing.
*/
public void addDocStoreUpdates(DocStoreUpdates docStoreUpdates) {
List<PersistRequestBean<?>> requests = getListenerNotify();
List<PersistRequestBean<?>> requests = listenerNotify();
if (requests != null) {
for (PersistRequestBean<?> persistRequestBean : requests) {
persistRequestBean.addDocStoreUpdates(docStoreUpdates);
@@ -136,7 +136,7 @@ public abstract class AbstractSqlQueryRequest implements CancelableQuery {
try {
query.checkCancelled();
prepareSql();
Connection conn = transaction.getInternalConnection();
Connection conn = transaction.internalConnection();
pstmt = conn.prepareStatement(sql);
if (query.getTimeout() > 0) {
pstmt.setQueryTimeout(query.getTimeout());
@@ -137,7 +137,7 @@ final class DefaultBeanLoader {
private List<?> executeQuery(LoadRequest loadRequest, SpiQuery<?> query) {
if (onIterateUseExtraTxn && loadRequest.isParentFindIterate()) {
// MySql - we need a different transaction to execute the secondary query
SpiTransaction extraTxn = server.createReadOnlyTransaction(query.getTenantId());
SpiTransaction extraTxn = server.createReadOnlyTransaction(query.tenantId());
try {
return server.findList(query, extraTxn);
} finally {
@@ -87,8 +87,8 @@ final class DefaultCallableSql implements Serializable, SpiCallableSql {
@Override
public Object getObject(int position) {
Param p = bindParameters.getParameter(position);
return p.getOutValue();
Param p = bindParameters.parameter(position);
return p.outValue();
}
@Override
@@ -108,12 +108,12 @@ final class DefaultCallableSql implements Serializable, SpiCallableSql {
* transaction after the transaction is committed.
*/
@Override
public TransactionEventTable getTransactionEventTable() {
public TransactionEventTable transactionEventTable() {
return transactionEvent;
}
@Override
public BindParams getBindParams() {
public BindParams bindParams() {
return bindParameters;
}
@@ -611,7 +611,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
PersistenceContext pc = null;
SpiTransaction t = transactionManager.active();
if (t != null) {
pc = t.getPersistenceContext();
pc = t.persistenceContext();
Object existing = desc.contextGet(pc, id);
if (existing != null) {
return (T) existing;
@@ -904,7 +904,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
public SpiResultSet findResultSet(SpiQuery<?> ormQuery, SpiTransaction transaction) {
SpiOrmQueryRequest<?> request = createQueryRequest(ormQuery.getType(), ormQuery, transaction);
SpiOrmQueryRequest<?> request = createQueryRequest(ormQuery.type(), ormQuery, transaction);
request.initTransIfRequired();
return request.findResultSet();
}
@@ -965,12 +965,12 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
query.selectAllForLazyLoadProperty();
}
ProfileLocation profileLocation = query.getProfileLocation();
ProfileLocation profileLocation = query.profileLocation();
if (profileLocation != null) {
profileLocation.obtain();
}
// if determine cost and no origin for AutoTune
if (query.getParentNode() == null) {
if (query.parentNode() == null) {
query.setOrigin(createCallOrigin());
}
return new OrmQueryRequest<>(this, queryEngine, query, (SpiTransaction) transaction);
@@ -986,12 +986,12 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
if (t == null) {
t = currentServerTransaction();
}
BeanDescriptor<T> desc = query.getBeanDescriptor();
BeanDescriptor<T> desc = query.descriptor();
id = desc.convertId(id);
PersistenceContext pc = null;
if (t != null && useTransactionPersistenceContext(query)) {
// first look in the transaction scoped persistence context
pc = t.getPersistenceContext();
pc = t.persistenceContext();
if (pc != null) {
WithOption o = desc.contextGetWithOption(pc, id);
if (o != null) {
@@ -1022,7 +1022,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
@Override
public PersistenceContextScope persistenceContextScope(SpiQuery<?> query) {
PersistenceContextScope scope = query.getPersistenceContextScope();
PersistenceContextScope scope = query.persistenceContextScope();
return (scope != null) ? scope : defaultPersistenceContextScope;
}
@@ -1031,7 +1031,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
private <T> T findId(Query<T> query, @Nullable Transaction transaction) {
SpiQuery<T> spiQuery = (SpiQuery<T>) query;
spiQuery.setType(Type.BEAN);
if (SpiQuery.Mode.NORMAL == spiQuery.getMode() && !spiQuery.isForceHitDatabase()) {
if (SpiQuery.Mode.NORMAL == spiQuery.mode() && !spiQuery.isForceHitDatabase()) {
// See if we can skip doing the fetch completely by getting the bean from the
// persistence context or the bean cache
T bean = findIdCheckPersistenceContextAndCache(transaction, spiQuery, spiQuery.getId());
@@ -2158,7 +2158,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
public void slowQueryCheck(long timeMicros, int rowCount, SpiQuery<?> query) {
if (timeMicros > slowQueryMicros && slowQueryListener != null) {
slowQueryListener.process(new SlowQueryEvent(query.getGeneratedSql(), timeMicros / 1000L, rowCount, query.getParentNode()));
slowQueryListener.process(new SlowQueryEvent(query.getGeneratedSql(), timeMicros / 1000L, rowCount, query.parentNode()));
}
}
@@ -246,7 +246,7 @@ public final class DefaultSqlUpdate implements Serializable, SpiSqlUpdate {
}
@Override
public String getBaseSql() {
public String baseSql() {
return baseSql;
}
@@ -342,7 +342,7 @@ public final class DefaultSqlUpdate implements Serializable, SpiSqlUpdate {
* Return the bind parameters.
*/
@Override
public BindParams getBindParams() {
public BindParams bindParams() {
return bindParams;
}
@@ -33,7 +33,7 @@ public final class DtoQueryRequest<T> extends AbstractSqlQueryRequest {
private DataReader dataReader;
DtoQueryRequest(SpiEbeanServer server, DtoQueryEngine engine, SpiDtoQuery<T> query) {
super(server, query, query.getTransaction());
super(server, query, query.transaction());
this.queryEngine = engine;
this.query = query;
query.obtainLocation();
@@ -45,7 +45,7 @@ public final class DtoQueryRequest<T> extends AbstractSqlQueryRequest {
@Override
public void executeSql(Binder binder, SpiQuery.Type type) throws SQLException {
startNano = System.nanoTime();
SpiQuery<?> ormQuery = query.getOrmQuery();
SpiQuery<?> ormQuery = query.ormQuery();
if (ormQuery != null) {
ormQuery.setType(type);
ormQuery.setManualId();
@@ -55,7 +55,7 @@ public final class DtoQueryRequest<T> extends AbstractSqlQueryRequest {
SpiResultSet result = server.findResultSet(ormQuery, transaction);
this.pstmt = result.getStatement();
this.sql = ormQuery.getGeneratedSql();
setResultSet(result.getResultSet(), ormQuery.getQueryPlanKey());
setResultSet(result.getResultSet(), ormQuery.queryPlanKey());
} else {
// native SQL query execution
@@ -74,7 +74,7 @@ public final class DtoQueryRequest<T> extends AbstractSqlQueryRequest {
if (planKey == null) {
planKey = query.planKey();
}
plan = query.getQueryPlan(planKey);
plan = query.queryPlan(planKey);
if (plan == null) {
plan = query.buildPlan(mappingRequest());
query.putQueryPlan(planKey, plan);
@@ -48,12 +48,12 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
public OrmQueryRequest(SpiEbeanServer server, OrmQueryEngine queryEngine, SpiQuery<T> query, SpiTransaction t) {
super(server, t);
this.beanDescriptor = query.getBeanDescriptor();
this.beanDescriptor = query.descriptor();
this.finder = beanDescriptor.beanFinder();
this.queryEngine = queryEngine;
this.query = query;
this.readOnly = query.isReadOnly();
this.persistenceContext = query.getPersistenceContext();
this.persistenceContext = query.persistenceContext();
}
public PersistenceException translate(String bindLog, String sql, SQLException e) {
@@ -188,7 +188,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
public DeployParser createDeployParser() {
if (query.isRawSql()) {
return new DeployPropertyParserMap(query.getRawSql().getColumnMapping().getMapping());
return new DeployPropertyParserMap(query.rawSql().getColumnMapping().getMapping());
} else {
return beanDescriptor.parser();
}
@@ -214,22 +214,22 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
public void initTransIfRequired() {
// first check if the query requires its own transaction
if (transaction == null) {
if (query.getType().isUpdate()) {
if (query.type().isUpdate()) {
// bulk update or delete query
transaction = server.beginServerTransaction();
} else {
// create an implicit transaction to execute this query
// potentially using read-only DataSource with autoCommit
transaction = server.createReadOnlyTransaction(query.getTenantId());
transaction = server.createReadOnlyTransaction(query.tenantId());
}
createdTransaction = true;
}
persistenceContext = persistenceContext(query, transaction);
if (Type.ITERATE == query.getType()) {
if (Type.ITERATE == query.type()) {
persistenceContext.beginIterate();
}
loadContext = new DLoadContext(this, secondaryQueries);
loadContext.useReferences(Type.ITERATE == query.getType());
loadContext.useReferences(Type.ITERATE == query.type());
}
/**
@@ -237,7 +237,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
*/
@Override
public void rollbackTransIfRequired() {
if (Type.ITERATE == query.getType()) {
if (Type.ITERATE == query.type()) {
persistenceContext.endIterate();
}
if (createdTransaction) {
@@ -258,7 +258,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
@Override
public JsonReadOptions createJsonReadOptions() {
persistenceContext = persistenceContext(query, transaction);
if (query.getPersistenceContext() == null) {
if (query.persistenceContext() == null) {
query.setPersistenceContext(persistenceContext);
}
JsonReadOptions jsonRead = new JsonReadOptions();
@@ -277,7 +277,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
private PersistenceContext persistenceContext(SpiQuery<?> query, SpiTransaction t) {
// check if there is already a persistence context set which is the case
// when lazy loading or query joins are executed
PersistenceContext ctx = query.getPersistenceContext();
PersistenceContext ctx = query.persistenceContext();
if (ctx != null) return ctx;
// determine the scope (from the query and then server)
@@ -285,7 +285,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
if (scope == PersistenceContextScope.QUERY || t == null) {
return new DefaultPersistenceContext();
}
return t.getPersistenceContext();
return t.persistenceContext();
}
/**
@@ -295,12 +295,12 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
*/
@Override
public void endTransIfRequired() {
if (Type.ITERATE == query.getType()) {
if (Type.ITERATE == query.type()) {
persistenceContext.endIterate();
}
if (createdTransaction && transaction.isActive()) {
transaction.commit();
if (query.getType().isUpdate()) {
if (query.type().isUpdate()) {
// for implicit update/delete queries clear the thread local
server.clearServerTransaction();
}
@@ -311,14 +311,14 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
* Return true if this is a find by id (rather than List Set or Map).
*/
public boolean isFindById() {
return query.getType() == Type.BEAN;
return query.type() == Type.BEAN;
}
/**
* Return true if this is a findEach, findIterate type query where we expect many results.
*/
public boolean isFindIterate() {
return query.getType() == Type.ITERATE;
return query.type() == Type.ITERATE;
}
@Override
@@ -421,7 +421,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
@Override
@SuppressWarnings("unchecked")
public <K> Map<K, T> findMap() {
String mapKey = query.getMapKey();
String mapKey = query.mapKey();
if (mapKey == null) {
BeanProperty idProp = beanDescriptor.idProperty();
if (idProp != null) {
@@ -497,7 +497,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
}
public boolean isQueryCachePut() {
return cacheKey != null && query.getUseQueryCache().isPut();
return cacheKey != null && query.queryCacheMode().isPut();
}
public boolean isBeanCachePutMany() {
@@ -513,7 +513,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
*/
public void mergeCacheHits(BeanCollection<T> result) {
if (cacheBeans != null && !cacheBeans.isEmpty()) {
if (query.getType() == Type.MAP) {
if (query.type() == Type.MAP) {
mergeCacheHitsToMap(result);
} else {
mergeCacheHitsToCollection(result);
@@ -572,7 +572,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
}
private ElPropertyValue mapProperty() {
final String key = query.getMapKey();
final String key = query.mapKey();
final ElPropertyValue property = key == null ? beanDescriptor.idProperty() : beanDescriptor.elGetValue(key);
if (property == null) {
throw new IllegalStateException("Unknown map key property " + key);
@@ -631,14 +631,14 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
@Override
@SuppressWarnings("unchecked")
public Object getFromQueryCache() {
if (query.getUseQueryCache() == CacheMode.OFF
if (query.queryCacheMode() == CacheMode.OFF
|| (transaction != null && transaction.isSkipCache())
|| server.isDisableL2Cache()) {
return null;
} else {
cacheKey = query.queryHash();
}
if (!query.getUseQueryCache().isGet()) {
if (!query.queryCacheMode().isGet()) {
return null;
}
@@ -674,7 +674,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
* it in read auditing. Return false for row count and find ids queries.
*/
private boolean readAuditQueryType() {
Type type = query.getType();
Type type = query.type();
switch (type) {
case BEAN:
case ITERATE:
@@ -688,7 +688,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
}
public void putToQueryCache(Object result) {
beanDescriptor.queryCachePut(cacheKey, new QueryCacheEntry(result, dependentTables, transaction.getStartNanoTime()));
beanDescriptor.queryCachePut(cacheKey, new QueryCacheEntry(result, dependentTables, transaction.startNanoTime()));
}
/**
@@ -709,7 +709,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
* Return the batch size for lazy loading on this bean query request.
*/
public int lazyLoadBatchSize() {
int batchSize = query.getLazyLoadBatchSize();
int batchSize = query.lazyLoadBatchSize();
return (batchSize > 0) ? batchSize : server.lazyLoadBatchSize();
}
@@ -740,7 +740,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
* Return the tenantId associated with this request.
*/
public Object tenantId() {
return (transaction == null) ? null : transaction.getTenantId();
return (transaction == null) ? null : transaction.tenantId();
}
/**
@@ -126,7 +126,7 @@ public abstract class PersistRequest extends BeanRequest implements BatchPostExe
boolean batch = isBatchThisRequest();
try {
int rows;
BatchControl control = transaction.getBatchControl();
BatchControl control = transaction.batchControl();
if (control != null) {
rows = control.executeStatementOrBatch(this, batch, addBatch);
@@ -192,7 +192,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
* don't want to send to the doc store.
*/
private DocStoreMode calcDocStoreMode(SpiTransaction txn, Type type) {
DocStoreMode txnMode = (txn == null) ? null : txn.getDocStoreMode();
DocStoreMode txnMode = (txn == null) ? null : txn.docStoreMode();
return beanDescriptor.docStoreMode(type, txnMode);
}
@@ -750,7 +750,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
public int executeOrQueue() {
boolean batch = isBatchThisRequest();
try {
BatchControl control = transaction.getBatchControl();
BatchControl control = transaction.batchControl();
if (control != null) {
return control.executeOrQueue(this, batch);
}
@@ -821,7 +821,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
*/
private void postUpdate() {
if (statelessUpdate) {
beanDescriptor.contextClear(transaction.getPersistenceContext(), idValue);
beanDescriptor.contextClear(transaction.persistenceContext(), idValue);
}
}
@@ -836,14 +836,14 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
*/
public void removeFromPersistenceContext() {
idValue = beanDescriptor.getId(entityBean);
beanDescriptor.contextDeleted(transaction.getPersistenceContext(), idValue);
beanDescriptor.contextDeleted(transaction.persistenceContext(), idValue);
}
/**
* Aggressive L1 and L2 cache cleanup for deletes.
*/
private void postDelete() {
beanDescriptor.contextClear(transaction.getPersistenceContext(), idValue);
beanDescriptor.contextClear(transaction.persistenceContext(), idValue);
}
private void changeLog() {
@@ -952,7 +952,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
* Add the request to TransactionEvent if there are post commit listeners.
*/
private void addPostCommitListeners() {
TransactionEvent event = transaction.getEvent();
TransactionEvent event = transaction.event();
if (event != null && isNotifyListeners()) {
event.addListenerNotify(this);
}
@@ -984,7 +984,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
}
if (transaction.isAutoPersistUpdates() && idValue != null) {
// with getGeneratedKeys off we will not have a idValue
beanDescriptor.contextPut(transaction.getPersistenceContext(), idValue, entityBean);
beanDescriptor.contextPut(transaction.persistenceContext(), idValue, entityBean);
}
}
@@ -1057,7 +1057,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
postExecute = true;
if (notifyCache && complete) {
// add cache notification (on batch persist)
TransactionEvent event = transaction.getEvent();
TransactionEvent event = transaction.event();
if (event != null) {
notifyCache(event.obtainCacheChangeSet());
}
@@ -1071,7 +1071,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
complete = true;
if (notifyCache && postExecute) {
// add cache notification (on non-batch persist)
TransactionEvent event = transaction.getEvent();
TransactionEvent event = transaction.event();
if (event != null) {
notifyCache(event.obtainCacheChangeSet());
}
@@ -1187,7 +1187,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
}
private void setTenantId() {
Object tenantId = transaction.getTenantId();
Object tenantId = transaction.tenantId();
if (tenantId != null) {
beanDescriptor.setTenantId(entityBean, tenantId);
}
@@ -1242,13 +1242,13 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
// processing now so set IGNORE (unlike DB + DocStore processing with post-commit)
docStoreMode = DocStoreMode.IGNORE;
try {
docStoreUpdate(transaction.getDocStoreTransaction().obtain());
docStoreUpdate(transaction.docStoreTransaction().obtain());
postExecute();
if (type == Type.UPDATE
&& beanDescriptor.isDocStoreEmbeddedInvalidation()
&& transaction.isPersistCascade()) {
// queue embedded/nested updates for later processing
beanDescriptor.docStoreUpdateEmbedded(this, transaction.getDocStoreTransaction().queue());
beanDescriptor.docStoreUpdateEmbedded(this, transaction.docStoreTransaction().queue());
}
} catch (IOException e) {
throw new PersistenceException("Error persisting doc store bean", e);
@@ -86,9 +86,9 @@ public final class PersistRequestCallableSql extends PersistRequest {
}
// register table modifications with the transaction event
TransactionEventTable tableEvents = callableSql.getTransactionEventTable();
TransactionEventTable tableEvents = callableSql.transactionEventTable();
if (tableEvents != null && !tableEvents.isEmpty()) {
transaction.getEvent().add(tableEvents);
transaction.event().add(tableEvents);
} else {
transaction.markNotQueryOnly();
}
@@ -19,7 +19,7 @@ public final class PersistRequestOrmUpdate extends PersistRequest {
private String bindLog;
public PersistRequestOrmUpdate(SpiEbeanServer server, BeanManager<?> mgr, SpiUpdate<?> ormUpdate, SpiTransaction t, PersistExecute persistExecute) {
super(server, t, persistExecute, ormUpdate.getLabel());
super(server, t, persistExecute, ormUpdate.label());
this.beanDescriptor = mgr.getBeanDescriptor();
this.ormUpdate = ormUpdate;
}
@@ -80,8 +80,8 @@ public final class PersistRequestOrmUpdate extends PersistRequest {
if (startNanos > 0) {
persistExecute.collectOrmUpdate(label, startNanos);
}
OrmUpdateType ormUpdateType = ormUpdate.getOrmUpdateType();
String tableName = ormUpdate.getBaseTable();
OrmUpdateType ormUpdateType = ormUpdate.ormUpdateType();
String tableName = ormUpdate.baseTable();
if (transaction.isLogSummary()) {
transaction.logSummary("{0} table[{1}] rows[{2}] bind[{3}]", ormUpdateType, tableName, rowCount, bindLog);
}
@@ -90,13 +90,13 @@ public final class PersistRequestOrmUpdate extends PersistRequest {
// this is used to invalidate cached objects etc
switch (ormUpdateType) {
case INSERT:
transaction.getEvent().add(tableName, true, false, false);
transaction.event().add(tableName, true, false, false);
break;
case UPDATE:
transaction.getEvent().add(tableName, false, true, false);
transaction.event().add(tableName, false, true, false);
break;
case DELETE:
transaction.getEvent().add(tableName, false, false, true);
transaction.event().add(tableName, false, false, true);
break;
default:
break;
@@ -65,7 +65,7 @@ public final class PersistRequestUpdateSql extends PersistRequest {
* Add this request to BatchControl to flush later.
*/
public void addToFlushQueue(int pos) {
BatchControl control = transaction.getBatchControl();
BatchControl control = transaction.batchControl();
if (control == null) {
control = persistExecute.createBatchControl(transaction);
}
@@ -167,13 +167,13 @@ public final class PersistRequestUpdateSql extends PersistRequest {
// this is used to invalidate cached objects etc
switch (sqlType) {
case SQL_INSERT:
transaction.getEvent().add(tableName, true, false, false);
transaction.event().add(tableName, true, false, false);
break;
case SQL_UPDATE:
transaction.getEvent().add(tableName, false, true, false);
transaction.event().add(tableName, false, true, false);
break;
case SQL_DELETE:
transaction.getEvent().add(tableName, false, false, true);
transaction.event().add(tableName, false, false, true);
break;
case SQL_UNKNOWN:
transaction.markNotQueryOnly();
@@ -48,7 +48,7 @@ public final class BeanCollectionHelpFactory {
} else if (manyType == SpiQuery.Type.MAP) {
BeanDescriptor<T> target = request.descriptor();
ElPropertyValue elProperty = target.elGetValue(request.query().getMapKey());
ElPropertyValue elProperty = target.elGetValue(request.query().mapKey());
return new BeanMapQueryHelp<>(elProperty);
} else {
@@ -1618,7 +1618,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Return the many property included in the query or null if one is not.
*/
public BeanPropertyAssocMany<?> manyProperty(SpiQuery<?> query) {
OrmQueryDetail detail = query.getDetail();
OrmQueryDetail detail = query.detail();
for (BeanPropertyAssocMany<?> many : propertiesMany) {
if (detail.includesPath(many.name())) {
return many;
@@ -755,7 +755,7 @@ final class BeanDescriptorCacheHelp<T> {
void cacheUpdateQuery(boolean update, SpiTransaction transaction) {
if (invalidateQueryCache || cacheNotifyOnAll || (!update && cacheNotifyOnDelete)) {
transaction.getEvent().add(desc.baseTable(), false, update, !update);
transaction.event().add(desc.baseTable(), false, update, !update);
}
}
@@ -421,11 +421,11 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
if (hasJoinTable()) {
sb.append(query.isAsDraft() ? intersectionDraftTable : intersectionPublishTable);
} else {
sb.append(targetDescriptor.baseTable(query.getTemporalMode()));
sb.append(targetDescriptor.baseTable(query.temporalMode()));
}
if (needsX2Table && hasJoinTable()) {
sb.append(" x join ");
sb.append(targetDescriptor.baseTable(query.getTemporalMode()));
sb.append(targetDescriptor.baseTable(query.temporalMode()));
sb.append(" x2 on ");
inverseJoin.addJoin("x2", "x", sb);
} else {
@@ -18,9 +18,9 @@ public final class DtoMappingRequest {
private final DtoColumn[] columnMeta;
public DtoMappingRequest(SpiDtoQuery query, String sql, DtoColumn[] columnMeta) {
this.type = query.getType();
this.label = query.getPlanLabel();
this.profileLocation = query.getProfileLocation();
this.type = query.type();
this.label = query.planLabel();
this.profileLocation = query.profileLocation();
this.sql = sql;
this.relaxedMode = query.isRelaxedMode();
this.columnMeta = columnMeta;
@@ -558,12 +558,12 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
@Override
public ExpressionList<T> addAll(ExpressionList<T> exprList) {
SpiExpressionList<T> spiList = (SpiExpressionList<T>) exprList;
list.addAll(spiList.getUnderlyingList());
list.addAll(spiList.underlyingList());
return this;
}
@Override
public List<SpiExpression> getUnderlyingList() {
public List<SpiExpression> underlyingList() {
return list;
}
@@ -21,7 +21,7 @@ public final class FilterExpressionList<T> extends DefaultExpressionList<T> {
private String orderByClause;
public FilterExpressionList(FilterExprPath pathPrefix, FilterExpressionList<T> original) {
super(null, original.expr, null, original.getUnderlyingList());
super(null, original.expr, null, original.underlyingList());
this.pathPrefix = pathPrefix;
this.rootQuery = original.rootQuery;
}
@@ -50,7 +50,7 @@ final class PrepareDocNested {
this.type = type;
this.beanDescriptor = beanDescriptor;
this.original = original;
this.origUnderlying = original.getUnderlyingList();
this.origUnderlying = original.underlyingList();
this.origSize = origUnderlying.size();
}
@@ -52,7 +52,7 @@ abstract class DLoadBaseContext {
void setLabel(SpiQuery<?> query) {
String label = parent.planLabel();
if (label != null) {
query.setProfilePath(label, fullPath + "(" + query.getLoadMode() + ")", parent.profileLocation());
query.setProfilePath(label, fullPath + "(" + query.loadMode() + ")", parent.profileLocation());
}
}
@@ -89,16 +89,16 @@ public final class DLoadContext implements LoadContext {
this.useDocStore = query.isUseDocStore();
this.asOf = query.getAsOf();
this.asDraft = query.isAsDraft();
this.includeSoftDeletes = query.isIncludeSoftDeletes() && query.getMode() == SpiQuery.Mode.NORMAL;
this.includeSoftDeletes = query.isIncludeSoftDeletes() && query.mode() == SpiQuery.Mode.NORMAL;
this.readOnly = query.isReadOnly();
this.disableReadAudit = query.isDisableReadAudit();
this.disableLazyLoading = query.isDisableLazyLoading();
this.useBeanCache = query.getUseBeanCache();
this.profilingListener = query.getProfilingListener();
this.planLabel = query.getPlanLabel();
this.profileLocation = query.getProfileLocation();
this.useBeanCache = query.beanCacheMode();
this.profilingListener = query.profilingListener();
this.planLabel = query.planLabel();
this.profileLocation = query.profileLocation();
ObjectGraphNode parentNode = query.getParentNode();
ObjectGraphNode parentNode = query.parentNode();
if (parentNode != null) {
this.origin = parentNode.origin();
this.relativePath = parentNode.path();
@@ -129,13 +129,13 @@ public final class DLoadContext implements LoadContext {
* Register the +query and +lazy secondary queries with their appropriate LoadBeanContext or LoadManyContext.
*/
private void registerSecondaryQueries(SpiQuerySecondary secondaryQueries) {
this.secQuery = secondaryQueries.getQueryJoins();
this.secQuery = secondaryQueries.queryJoins();
if (secQuery != null) {
for (OrmQueryProperties pathProperties : secQuery) {
registerSecondaryQuery(pathProperties);
}
}
List<OrmQueryProperties> lazyJoins = secondaryQueries.getLazyJoins();
List<OrmQueryProperties> lazyJoins = secondaryQueries.lazyJoins();
if (lazyJoins != null) {
for (OrmQueryProperties lazyJoin : lazyJoins) {
registerSecondaryQuery(lazyJoin);
@@ -105,13 +105,13 @@ public final class Binder {
for (BindParams.Param param : list) {
if (param.isOutParam() && cstmt != null) {
cstmt.registerOutParameter(dataBind.nextPos(), param.getType());
cstmt.registerOutParameter(dataBind.nextPos(), param.type());
if (param.isInParam()) {
dataBind.decrementPos();
}
}
if (param.isInParam()) {
value = param.getInValue();
value = param.inValue();
if (bindLog != null) {
if (bindLog.length() > 0) {
bindLog.append(", ");
@@ -128,7 +128,7 @@ public final class Binder {
}
} else if (value == null) {
// this doesn't work for query predicates
bindObject(dataBind, null, param.getType());
bindObject(dataBind, null, param.type());
} else {
bindObject(dataBind, value);
}
@@ -72,7 +72,7 @@ public final class DefaultPersister implements Persister {
@Override
public int executeOrmUpdate(Update<?> update, Transaction t) {
SpiUpdate<?> ormUpdate = (SpiUpdate<?>) update;
BeanManager<?> mgr = beanManager(ormUpdate.getBeanType());
BeanManager<?> mgr = beanManager(ormUpdate.beanType());
return executeOrQueue(new PersistRequestOrmUpdate(server, mgr, ormUpdate, (SpiTransaction) t, persistExecute));
}
@@ -97,7 +97,7 @@ public final class DefaultPersister implements Persister {
@Override
public int[] executeBatch(SpiSqlUpdate sqlUpdate, SpiTransaction transaction) {
BatchControl batchControl = transaction.getBatchControl();
BatchControl batchControl = transaction.batchControl();
try {
return batchControl.execute(sqlUpdate.getGeneratedSql(), sqlUpdate.isGetGeneratedKeys());
} catch (SQLException e) {
@@ -761,14 +761,14 @@ public final class DefaultPersister implements Persister {
notifyDeleteById(descriptor, id, idList, transaction);
deleteById.setAutoTableMod(false);
if (idList != null) {
t.getEvent().addDeleteByIdList(descriptor, idList);
t.event().addDeleteByIdList(descriptor, idList);
} else {
t.getEvent().addDeleteById(descriptor, id);
t.event().addDeleteById(descriptor, id);
}
int rows = executeSqlUpdate(deleteById, t);
// Delete from the persistence context so that it can't be fetched again later
PersistenceContext persistenceContext = t.getPersistenceContext();
PersistenceContext persistenceContext = t.persistenceContext();
if (idList != null) {
for (Object idValue : idList) {
descriptor.contextDeleted(persistenceContext, idValue);
@@ -60,7 +60,7 @@ final class ExeCallableSql {
SpiTransaction t = request.transaction();
String sql = callableSql.getSql();
BindParams bindParams = callableSql.getBindParams();
BindParams bindParams = callableSql.bindParams();
// process named parameters if required
sql = BindParamsParser.parse(bindParams, sql);
@@ -80,7 +80,7 @@ final class ExeCallableSql {
}
String bindLog = null;
if (!bindParams.isEmpty()) {
bindLog = binder.bind(bindParams, cstmt, t.getInternalConnection());
bindLog = binder.bind(bindParams, cstmt, t.internalConnection());
}
request.setBindLog(bindLog);
// required to read OUT params later
@@ -39,8 +39,8 @@ final class ExeOrmUpdate {
return -1;
} else {
SpiUpdate<?> ormUpdate = request.ormUpdate();
if (ormUpdate.getTimeout() > 0) {
pstmt.setQueryTimeout(ormUpdate.getTimeout());
if (ormUpdate.timeout() > 0) {
pstmt.setQueryTimeout(ormUpdate.timeout());
}
int rowCount = pstmt.executeUpdate();
request.checkRowCount(rowCount);
@@ -71,11 +71,11 @@ final class ExeOrmUpdate {
SpiUpdate<?> ormUpdate = request.ormUpdate();
SpiTransaction t = request.transaction();
String sql = ormUpdate.getUpdateStatement();
String sql = ormUpdate.updateStatement();
// convert bean and property names to table and
// column names if required
sql = translate(request, sql);
BindParams bindParams = ormUpdate.getBindParams();
BindParams bindParams = ormUpdate.bindParams();
// process named parameters if required
sql = BindParamsParser.parse(bindParams, sql);
ormUpdate.setGeneratedSql(sql);
@@ -91,7 +91,7 @@ final class ExeOrmUpdate {
}
String bindLog = null;
if (!bindParams.isEmpty()) {
bindLog = binder.bind(bindParams, pstmt, t.getInternalConnection());
bindLog = binder.bind(bindParams, pstmt, t.internalConnection());
}
request.setBindLog(bindLog);
return pstmt;
@@ -77,10 +77,10 @@ final class ExeUpdateSql {
SpiSqlUpdate updateSql = request.updateSql();
SpiTransaction t = request.transaction();
BindParams bindParams = updateSql.getBindParams();
BindParams bindParams = updateSql.bindParams();
// process named parameters if required
String sql = updateSql.getBaseSql();
String sql = updateSql.baseSql();
sql = BindParamsParser.parse(bindParams, sql);
parseUpdate(sql, request);
@@ -95,7 +95,7 @@ final class ExeUpdateSql {
}
String bindLog = null;
if (!bindParams.isEmpty()) {
bindLog = binder.bind(bindParams, pstmt, t.getInternalConnection());
bindLog = binder.bind(bindParams, pstmt, t.internalConnection());
}
request.setBindLog(bindLog);
updateSql.setGeneratedSql(sql);
@@ -21,7 +21,7 @@ final class PstmtFactory {
* Get a callable statement without any batching.
*/
CallableStatement cstmt(SpiTransaction t, String sql) throws SQLException {
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
return conn.prepareCall(sql);
}
@@ -29,7 +29,7 @@ final class PstmtFactory {
* Get a prepared statement without any batching.
*/
PreparedStatement pstmt(SpiTransaction t, String sql, boolean getGeneratedKeys) throws SQLException {
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
if (getGeneratedKeys) {
return conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
} else {
@@ -41,7 +41,7 @@ final class PstmtFactory {
* Return a prepared statement taking into account batch requirements.
*/
PreparedStatement pstmtBatch(SpiTransaction t, String sql, BatchPostExecute batchExe) throws SQLException {
BatchedPstmtHolder batch = t.getBatchControl().pstmtHolder();
BatchedPstmtHolder batch = t.batchControl().pstmtHolder();
BatchedPstmt existingStmt = batch.batchedPstmt(sql);
if (existingStmt != null) {
if (existingStmt.isEmpty() && t.isLogSql()) {
@@ -52,7 +52,7 @@ final class PstmtFactory {
if (t.isLogSql()) {
t.logSql(TrimLogSql.trim(sql));
}
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
PreparedStatement stmt = conn.prepareStatement(sql);
BatchedPstmt bs = new BatchedPstmt(stmt, false, sql, t);
batch.addStmt(bs, batchExe);
@@ -63,7 +63,7 @@ final class PstmtFactory {
* Return a callable statement taking into account batch requirements.
*/
CallableStatement cstmtBatch(SpiTransaction t, boolean logSql, String sql, BatchPostExecute batchExe) throws SQLException {
BatchedPstmtHolder batch = t.getBatchControl().pstmtHolder();
BatchedPstmtHolder batch = t.batchControl().pstmtHolder();
CallableStatement stmt = (CallableStatement) batch.stmt(sql, batchExe);
if (stmt != null) {
return stmt;
@@ -71,7 +71,7 @@ final class PstmtFactory {
if (logSql) {
t.logSql(sql);
}
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
stmt = conn.prepareCall(sql);
BatchedPstmt bs = new BatchedPstmt(stmt, false, sql, t);
batch.addStmt(bs, batchExe);
@@ -179,7 +179,7 @@ final class SaveManyBeans extends SaveManyBase {
if (hasOrderColumn && !clearedParent) {
// Clear the parent bean from the PersistenceContext (L1 cache), because the order of referenced beans might have changed
final BeanDescriptor<?> beanDescriptor = many.descriptor();
beanDescriptor.contextClear(transaction.getPersistenceContext(), beanDescriptor.getId(parentBean));
beanDescriptor.contextClear(transaction.persistenceContext(), beanDescriptor.getId(parentBean));
clearedParent = true;
}
}
@@ -66,7 +66,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
* Bind to the statement returning the DataBind.
*/
DataBind bind(PreparedStatement stmt) {
return new DataBind(persistRequest.dataTimeZone(), stmt, transaction.getInternalConnection());
return new DataBind(persistRequest.dataTimeZone(), stmt, transaction.internalConnection());
}
/**
@@ -234,7 +234,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
* Check with useGeneratedKeys to get appropriate PreparedStatement.
*/
PreparedStatement getPstmt(SpiTransaction t, String sql, boolean genKeys) throws SQLException {
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
if (genKeys) {
// the Id generated is always the first column
// Required to stop Oracle10 giving us Oracle rowId??
@@ -249,7 +249,7 @@ public abstract class DmlHandler implements PersistHandler, BindableRequest {
* Return a prepared statement taking into account batch requirements.
*/
PreparedStatement getPstmtBatch(SpiTransaction t, String sql, PersistRequestBean<?> request, boolean genKeys) throws SQLException {
BatchedPstmtHolder batch = t.getBatchControl().pstmtHolder();
BatchedPstmtHolder batch = t.batchControl().pstmtHolder();
batchedPstmt = batch.batchedPstmt(sql);
if (batchedPstmt != null) {
batchedStatus = batchedPstmt.isEmpty() ? BATCHED_FIRST : BATCHED;
@@ -89,7 +89,7 @@ public final class InsertHandler extends DmlHandler {
*/
@Override
PreparedStatement getPstmt(SpiTransaction t, String sql, boolean useGeneratedKeys) throws SQLException {
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
if (useGeneratedKeys) {
return conn.prepareStatement(sql, meta.getIdentityDbColumns());
@@ -37,7 +37,7 @@ public final class UpdateHandler extends DmlHandler {
return;
}
sql = updatePlan.getSql();
sql = updatePlan.sql();
SpiTransaction t = persistRequest.transaction();
PreparedStatement pstmt;
if (persistRequest.isBatched()) {
@@ -45,27 +45,27 @@ final class UpdatePlan implements SpiUpdatePlan {
}
@Override
public long getTimeCreated() {
public long timeCreated() {
return timeCreated;
}
@Override
public long getTimeLastUsed() {
public long timeLastUsed() {
return timeLastUsed;
}
@Override
public String getKey() {
public String key() {
return key;
}
@Override
public ConcurrencyMode getMode() {
public ConcurrencyMode mode() {
return mode;
}
@Override
public String getSql() {
public String sql() {
return sql;
}
@@ -183,13 +183,13 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
this.audit = request.isAuditReads();
this.queryPlan = queryPlan;
this.query = request.query();
this.queryMode = query.getMode();
this.queryMode = query.mode();
this.loadContextBean = queryMode.isLoadContextBean() || query.getForUpdateLockType() != null;
this.lazyLoadManyProperty = query.getLazyLoadMany();
this.lazyLoadManyProperty = query.lazyLoadMany();
this.readOnly = request.isReadOnly();
this.disableLazyLoading = query.isDisableLazyLoading();
this.objectGraphNode = query.getParentNode();
this.profilingListener = query.getProfilingListener();
this.objectGraphNode = query.parentNode();
this.profilingListener = query.profilingListener();
this.autoTuneProfiling = profilingListener != null;
// set the generated sql back to the query
// so its available to the user...
@@ -214,7 +214,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
if (request.isFindById()) {
return null;
} else {
SpiQuery.Type manyType = request.query().getType();
SpiQuery.Type manyType = request.query().type();
if (manyType == null) {
// subQuery compiled for InQueryExpression
return null;
@@ -312,7 +312,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
SpiTransaction t = request.transaction();
profileOffset = t.profileOffset();
if (query.isRawSql()) {
ResultSet suppliedResultSet = query.getRawSql().getResultSet();
ResultSet suppliedResultSet = query.rawSql().getResultSet();
if (suppliedResultSet != null) {
// this is a user supplied ResultSet so use that
bindLog = "";
@@ -320,7 +320,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
}
}
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
if (forwardOnlyHint) {
// Use forward only hints for large resultSet processing (Issue 56, MySql specific)
pstmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
@@ -328,11 +328,11 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
} else {
pstmt = conn.prepareStatement(sql);
}
if (query.getTimeout() > 0) {
pstmt.setQueryTimeout(query.getTimeout());
if (query.timeout() > 0) {
pstmt.setQueryTimeout(query.timeout());
}
if (query.getBufferFetchSizeHint() > 0) {
pstmt.setFetchSize(query.getBufferFetchSizeHint());
if (query.bufferFetchSizeHint() > 0) {
pstmt.setFetchSize(query.bufferFetchSizeHint());
}
bindLog = predicates.bind(queryPlan.bindEncryptedProperties(pstmt, conn));
} finally {
@@ -566,7 +566,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
public void profile() {
transaction()
.profileStream()
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), loadedBeanCount, query.getProfileId());
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), loadedBeanCount, query.profileId());
}
QueryIterator<T> readIterate(int bufferSize, OrmQueryRequest<T> request) {
@@ -695,7 +695,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
void auditFindMany() {
if (auditIds != null && !auditIds.isEmpty()) {
// get the id values of the underlying collection
ReadEvent futureReadEvent = query.getFutureFetchAudit();
ReadEvent futureReadEvent = query.futureFetchAudit();
if (futureReadEvent == null) {
// normal query execution
desc.readAuditMany(queryPlan.auditQueryKey(), bindLog, auditIds);
@@ -1,7 +1,6 @@
package io.ebeaninternal.server.query;
import io.ebean.CountDistinctOrder;
import io.ebean.OrderBy;
import io.ebean.Query;
import io.ebean.RawSql;
import io.ebean.RawSqlBuilder;
@@ -91,7 +90,7 @@ final class CQueryBuilder {
*/
<T> CQueryUpdate buildUpdateQuery(boolean deleteRequest, OrmQueryRequest<T> request) {
SpiQuery<T> query = request.query();
String rootTableAlias = query.getAlias();
String rootTableAlias = query.alias();
query.setupForDeleteOrUpdate();
CQueryPredicates predicates = new CQueryPredicates(binder, request);
@@ -183,7 +182,7 @@ final class CQueryBuilder {
if (!query.isIncludeSoftDeletes()) {
BeanDescriptor<?> desc = request.descriptor();
if (desc.isSoftDelete()) {
query.addSoftDeletePredicate(desc.softDeletePredicate(alias(query.getAlias())));
query.addSoftDeletePredicate(desc.softDeletePredicate(alias(query.alias())));
}
}
CQueryPredicates predicates = new CQueryPredicates(binder, request);
@@ -211,7 +210,7 @@ final class CQueryBuilder {
query.setSelectId();
BeanDescriptor<T> desc = request.descriptor();
if (!query.isIncludeSoftDeletes() && desc.isSoftDelete()) {
query.addSoftDeletePredicate(desc.softDeletePredicate(alias(query.getAlias())));
query.addSoftDeletePredicate(desc.softDeletePredicate(alias(query.alias())));
}
return buildFetchAttributeQuery(request);
}
@@ -220,14 +219,14 @@ final class CQueryBuilder {
* Return the history support if this query needs it (is a 'as of' type query).
*/
<T> CQueryHistorySupport historySupport(SpiQuery<T> query) {
return query.getTemporalMode().isHistory() ? historySupport : null;
return query.temporalMode().isHistory() ? historySupport : null;
}
/**
* Return the draft support (or null) for a 'asDraft' query.
*/
<T> CQueryDraftSupport draftSupport(SpiQuery<T> query) {
return query.getTemporalMode() == SpiQuery.TemporalMode.DRAFT ? draftSupport : null;
return query.temporalMode() == SpiQuery.TemporalMode.DRAFT ? draftSupport : null;
}
/**
@@ -260,7 +259,7 @@ final class CQueryBuilder {
predicates.prepare(true);
SqlTree sqlTree = createSqlTree(request, predicates, selectCountWithColumnAlias && withAgg);
if (SpiQuery.TemporalMode.CURRENT == query.getTemporalMode()) {
if (SpiQuery.TemporalMode.CURRENT == query.temporalMode()) {
sqlTree.addSoftDeletePredicate(query);
}
@@ -298,7 +297,7 @@ final class CQueryBuilder {
* Return true if the query includes an aggregation property.
*/
private <T> boolean includesAggregation(OrmQueryRequest<T> request, SpiQuery<T> query) {
return request.descriptor().includesAggregation(query.getDetail());
return request.descriptor().includesAggregation(query.detail());
}
private String wrapSelectCount(String sql) {
@@ -335,7 +334,7 @@ final class CQueryBuilder {
SqlTree sqlTree = createSqlTree(request, predicates);
if (query.isAsOfQuery()) {
sqlTree.addAsOfTableAlias(query);
} else if (SpiQuery.TemporalMode.CURRENT == query.getTemporalMode()) {
} else if (SpiQuery.TemporalMode.CURRENT == query.temporalMode()) {
sqlTree.addSoftDeletePredicate(query);
}
@@ -391,12 +390,12 @@ final class CQueryBuilder {
private SqlTree createNativeSqlTree(OrmQueryRequest<?> request, CQueryPredicates predicates) {
SpiQuery<?> query = request.query();
// parse named parameters returning the final sql to execute
String sql = predicates.parseBindParams(query.getNativeSql());
String sql = predicates.parseBindParams(query.nativeSql());
if (query.hasMaxRowsOrFirstRow()) {
sql = nativeQueryPaging(query, sql);
}
query.setGeneratedSql(sql);
Connection connection = request.transaction().getInternalConnection();
Connection connection = request.transaction().internalConnection();
BeanDescriptor<?> desc = request.descriptor();
try {
// For SqlServer we need either "selectMethod=cursor" in the connection string or fetch explicitly a cursorable
@@ -429,7 +428,7 @@ final class CQueryBuilder {
private SqlTree createRawSqlSqlTree(OrmQueryRequest<?> request, CQueryPredicates predicates) {
BeanDescriptor<?> descriptor = request.descriptor();
ColumnMapping columnMapping = request.query().getRawSql().getColumnMapping();
ColumnMapping columnMapping = request.query().rawSql().getColumnMapping();
PathProperties pathProps = new PathProperties();
// convert list of columns into (tree like) PathProperties
@@ -511,7 +510,7 @@ final class CQueryBuilder {
return new SqlLimitResponse(query.getGeneratedSql());
}
if (query.isRawSql()) {
return rawSqlHandler.buildSql(request, predicates, query.getRawSql().getSql());
return rawSqlHandler.buildSql(request, predicates, query.rawSql().getSql());
}
return new BuildReq(selectClause, request, predicates, select).buildSql();
}
@@ -649,7 +648,7 @@ final class CQueryBuilder {
if (request.isFindById() || query.getId() != null) {
appendAndOrWhere();
BeanDescriptor<?> desc = request.descriptor();
String idSql = desc.idBinderIdSql(query.getAlias());
String idSql = desc.idBinderIdSql(query.alias());
if (idSql.isEmpty()) {
throw new IllegalStateException("Executing FindById query on entity bean " + desc.name()
+ " that doesn't have an @Id property??");
@@ -671,7 +670,7 @@ final class CQueryBuilder {
}
private void appendSoftDelete() {
List<String> softDeletePredicates = query.getSoftDeletePredicates();
List<String> softDeletePredicates = query.softDeletePredicates();
if (softDeletePredicates != null) {
appendAndOrWhere();
for (int i = 0; i < softDeletePredicates.size(); i++) {
@@ -707,7 +706,7 @@ final class CQueryBuilder {
}
if (countSingleAttribute) {
sb.append(") r1 group by r1.attribute_");
sb.append(toSql(query.getCountDistinctOrder()));
sb.append(toSql(query.countDistinctOrder()));
}
if (useSqlLimiter) {
// use LIMIT/OFFSET, ROW_NUMBER() or rownum type SQL query limitation
@@ -32,7 +32,7 @@ final class CQueryBuilderRawSql {
}
if (!rsql.isParsed()) {
String sql = rsql.getUnparsedSql();
BindParams bindParams = request.query().getBindParams();
BindParams bindParams = request.query().bindParams();
if (bindParams != null && bindParams.requiresNamedParamsPrepare()) {
// convert named parameters into positioned parameters
sql = BindParamsParser.parse(bindParams, sql);
@@ -57,7 +57,7 @@ final class CQueryBuilderRawSql {
private String buildMainQuery(String orderBy, OrmQueryRequest<?> request, CQueryPredicates predicates, SpiRawSql.Sql sql) {
StringBuilder sb = new StringBuilder();
OrmQueryProperties ormQueryProperties = request.query().getDetail().getChunk(null, false);
OrmQueryProperties ormQueryProperties = request.query().detail().getChunk(null, false);
if (ormQueryProperties.hasSelectClause()) {
boolean first = true;
for (String selectProperty : ormQueryProperties.getIncluded()) {
@@ -73,7 +73,7 @@ final class CQueryBuilderRawSql {
sb.append(" ");
String s = sql.getPreWhere();
BindParams bindParams = request.query().getBindParams();
BindParams bindParams = request.query().bindParams();
if (bindParams != null && bindParams.requiresNamedParamsPrepare()) {
// convert named parameters into positioned parameters
// Named Parameters only allowed prior to dynamic where
@@ -198,7 +198,7 @@ public final class CQueryEngine {
int iterateBufferSize = request.secondaryQueriesMinBatchSize();
if (iterateBufferSize < 1) {
// not set on query joins so check if batch size set on query itself
int queryBatch = request.query().getLazyLoadBatchSize();
int queryBatch = request.query().lazyLoadBatchSize();
if (queryBatch > 0) {
iterateBufferSize = queryBatch;
} else {
@@ -235,8 +235,8 @@ public final class CQueryEngine {
SpiQuery<T> query = request.query();
String sysPeriodLower = getSysPeriodLower(query);
if (query.isVersionsBetween() && !historySupport.isStandardsBased()) {
query.where().lt(sysPeriodLower, query.getVersionEnd());
query.where().geOrNull(getSysPeriodUpper(query), query.getVersionStart());
query.where().lt(sysPeriodLower, query.versionEnd());
query.where().geOrNull(getSysPeriodUpper(query), query.versionStart());
}
// order by lower sys period desc
@@ -410,10 +410,10 @@ public final class CQueryEngine {
*/
private void logFindBeanSummary(CQuery<?> q) {
SpiQuery<?> query = q.request().query();
String loadMode = query.getLoadMode();
String loadDesc = query.getLoadDescription();
String lazyLoadProp = query.getLazyLoadProperty();
ObjectGraphNode node = query.getParentNode();
String loadMode = query.loadMode();
String loadDesc = query.loadDescription();
String lazyLoadProp = query.lazyLoadProperty();
ObjectGraphNode node = query.parentNode();
String originKey;
if (node == null || node.origin() == null) {
originKey = null;
@@ -453,10 +453,10 @@ public final class CQueryEngine {
*/
private void logFindManySummary(CQuery<?> q) {
SpiQuery<?> query = q.request().query();
String loadMode = query.getLoadMode();
String loadDesc = query.getLoadDescription();
String lazyLoadProp = query.getLazyLoadProperty();
ObjectGraphNode node = query.getParentNode();
String loadMode = query.loadMode();
String loadDesc = query.loadDescription();
String lazyLoadProp = query.lazyLoadProperty();
ObjectGraphNode node = query.parentNode();
String originKey;
if (node == null || node.origin() == null) {
@@ -125,13 +125,13 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
query.checkCancelled();
SpiTransaction t = transaction();
profileOffset = t.profileOffset();
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
pstmt = conn.prepareStatement(sql);
if (query.getBufferFetchSizeHint() > 0) {
pstmt.setFetchSize(query.getBufferFetchSizeHint());
if (query.bufferFetchSizeHint() > 0) {
pstmt.setFetchSize(query.bufferFetchSizeHint());
}
if (query.getTimeout() > 0) {
pstmt.setQueryTimeout(query.getTimeout());
if (query.timeout() > 0) {
pstmt.setQueryTimeout(query.timeout());
}
bindLog = predicates.bind(pstmt, conn);
} finally {
@@ -165,7 +165,7 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
public void profile() {
transaction()
.profileStream()
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), rowCount, query.getProfileId());
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), rowCount, query.profileId());
}
Set<String> dependentTables() {
@@ -85,10 +85,10 @@ public class CQueryPlan implements SpiQueryPlan {
this.beanType = request.descriptor().type();
this.planKey = request.queryPlanKey();
SpiQuery<?> query = request.query();
this.profileLocation = query.getProfileLocation();
this.profileLocation = query.profileLocation();
this.location = (profileLocation == null) ? null : profileLocation.location();
this.label = query.getPlanLabel();
this.name = deriveName(label, query.getType(), request.descriptor().simpleName());
this.label = query.planLabel();
this.name = deriveName(label, query.type(), request.descriptor().simpleName());
this.asOfTableCount = query.getAsOfTableCount();
this.sql = sqlRes.getSql();
this.sqlTree = sqlTree;
@@ -109,10 +109,10 @@ public class CQueryPlan implements SpiQueryPlan {
this.dataTimeZone = server.dataTimeZone();
this.beanType = request.descriptor().type();
SpiQuery<?> query = request.query();
this.profileLocation = query.getProfileLocation();
this.profileLocation = query.profileLocation();
this.location = (profileLocation == null) ? null : profileLocation.location();
this.label = query.getPlanLabel();
this.name = deriveName(label, query.getType(), request.descriptor().simpleName());
this.label = query.planLabel();
this.name = deriveName(label, query.type(), request.descriptor().simpleName());
this.planKey = buildPlanKey(sql, logWhereSql);
this.asOfTableCount = 0;
this.sql = sql;
@@ -142,11 +142,11 @@ public class CQueryPlan implements SpiQueryPlan {
}
private SpiQueryBindCapture initBindCapture(SpiQuery<?> query) {
return query.getType().isUpdate() ? SpiQueryBindCapture.NOOP : server.createQueryBindCapture(this);
return query.type().isUpdate() ? SpiQueryBindCapture.NOOP : server.createQueryBindCapture(this);
}
private SpiQueryBindCapture initBindCaptureRaw(String sql, SpiQuery<?> query) {
return sql.equals(RESULT_SET_BASED_RAW_SQL) || query.getType().isUpdate() ? SpiQueryBindCapture.NOOP : server.createQueryBindCapture(this);
return sql.equals(RESULT_SET_BASED_RAW_SQL) || query.type().isUpdate() ? SpiQueryBindCapture.NOOP : server.createQueryBindCapture(this);
}
private CQueryPlanKey buildPlanKey(String sql, String logWhereSql) {
@@ -30,8 +30,8 @@ public final class CQueryPlanManager implements QueryPlanManager {
this.transactionManager = transactionManager;
this.defaultThreshold = defaultThreshold;
this.planLogger = planLogger;
this.timeCollection = extraMetrics.getPlanCollect();
this.timeBindCapture = extraMetrics.getBindCapture();
this.timeCollection = extraMetrics.planCollect();
this.timeBindCapture = extraMetrics.bindCapture();
}
@Override
@@ -28,7 +28,7 @@ final class CQueryPlanRawSql extends CQueryPlan {
private int[] createIndexPositions(OrmQueryRequest<?> request, SqlTree sqlTree) {
List<String> chain = sqlTree.buildRawSqlSelectChain();
ColumnMapping columnMapping = request.query().getRawSql().getColumnMapping();
ColumnMapping columnMapping = request.query().rawSql().getColumnMapping();
int[] indexPositions = new int[chain.size()];
@@ -76,7 +76,7 @@ public final class CQueryPredicates {
this.binder = binder;
this.request = request;
this.query = request.query();
this.bindParams = query.getBindParams();
this.bindParams = query.bindParams();
this.idValue = query.getId();
}
@@ -85,15 +85,15 @@ public final class CQueryPredicates {
}
public String bind(DataBind dataBind) throws SQLException {
OrmUpdateProperties updateProperties = query.getUpdateProperties();
OrmUpdateProperties updateProperties = query.updateProperties();
if (updateProperties != null) {
// bind the update set clause
updateProperties.bind(binder, dataBind);
}
if (query.isVersionsBetween() && binder.isAsOfStandardsBased()) {
// sql2011 based versions between timestamp syntax
Timestamp start = query.getVersionStart();
Timestamp end = query.getVersionEnd();
Timestamp start = query.versionStart();
Timestamp end = query.versionEnd();
dataBind.append("between ").append(start).append(" and ").append(end);
binder.bindObject(dataBind, start);
binder.bindObject(dataBind, end);
@@ -137,7 +137,7 @@ public final class CQueryPredicates {
private void buildUpdateClause(boolean buildSql, DeployParser deployParser) {
if (buildSql) {
OrmUpdateProperties updateProperties = query.getUpdateProperties();
OrmUpdateProperties updateProperties = query.updateProperties();
if (updateProperties != null) {
dbUpdateClause = updateProperties.buildSetClause(deployParser);
}
@@ -159,14 +159,14 @@ public final class CQueryPredicates {
if (!buildSql && bindParams != null && bindParams.requiresNamedParamsPrepare()) {
if (query.isNativeSql()) {
// convert named params into positioned params
String sql = query.getNativeSql();
String sql = query.nativeSql();
BindParamsParser.parse(bindParams, sql);
} else if (query.isRawSql()) {
// RawSql query hit cached query plan. Need to convert
// named parameters into positioned parameters so that
// the named parameters are bound
SpiRawSql.Sql sql = query.getRawSql().getSql();
SpiRawSql.Sql sql = query.rawSql().getSql();
String s = sql.isParsed() ? sql.getPreWhere() : sql.getUnparsedSql();
BindParamsParser.parse(bindParams, s);
}
@@ -187,7 +187,7 @@ public final class CQueryPredicates {
// create a copy of the includes required to support the orderBy
orderByIncludes = new HashSet<>(deployParser.includes());
}
SpiExpressionList<?> whereExp = query.getWhereExpressions();
SpiExpressionList<?> whereExp = query.whereExpressions();
if (whereExp != null) {
this.where = new DefaultExpressionRequest(request, deployParser, binder, whereExp);
if (buildSql) {
@@ -195,7 +195,7 @@ public final class CQueryPredicates {
}
}
if (manyProperty != null) {
OrmQueryProperties chunk = query.getDetail().getChunk(manyProperty.name(), false);
OrmQueryProperties chunk = query.detail().getChunk(manyProperty.name(), false);
SpiExpressionList<?> filterManyExpr = chunk.getFilterMany();
if (filterManyExpr != null) {
this.filterMany = new DefaultExpressionRequest(request, deployParser, binder, filterManyExpr);
@@ -204,7 +204,7 @@ public final class CQueryPredicates {
}
}
}
SpiExpressionList<?> havingExpr = query.getHavingExpressions();
SpiExpressionList<?> havingExpr = query.havingExpressions();
if (havingExpr != null) {
this.having = new DefaultExpressionRequest(request, deployParser, binder, havingExpr);
if (buildSql) {
@@ -89,13 +89,13 @@ final class CQueryRowCount implements SpiProfileTransactionEvent, CancelableQuer
try {
SpiTransaction t = transaction();
profileOffset = t.profileOffset();
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
lock.lock();
try {
query.checkCancelled();
pstmt = conn.prepareStatement(sql);
if (query.getTimeout() > 0) {
pstmt.setQueryTimeout(query.getTimeout());
if (query.timeout() > 0) {
pstmt.setQueryTimeout(query.timeout());
}
bindLog = predicates.bind(pstmt, conn);
} finally {
@@ -137,7 +137,7 @@ final class CQueryRowCount implements SpiProfileTransactionEvent, CancelableQuer
public void profile() {
transaction()
.profileStream()
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), rowCount, query.getProfileId());
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), rowCount, query.profileId());
}
Set<String> dependentTables() {
@@ -66,13 +66,13 @@ final class CQueryUpdate implements SpiProfileTransactionEvent, CancelableQuery
try {
SpiTransaction t = transaction();
profileOffset = t.profileOffset();
Connection conn = t.getInternalConnection();
Connection conn = t.internalConnection();
lock.lock();
try {
query.checkCancelled();
pstmt = conn.prepareStatement(sql);
if (query.getTimeout() > 0) {
pstmt.setQueryTimeout(query.getTimeout());
if (query.timeout() > 0) {
pstmt.setQueryTimeout(query.timeout());
}
bindLog = predicates.bind(pstmt, conn);
} finally {
@@ -113,7 +113,7 @@ final class CQueryUpdate implements SpiProfileTransactionEvent, CancelableQuery
public void profile() {
transaction()
.profileStream()
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), rowCount, query.getProfileId());
.addQueryEvent(query.profileEventId(), profileOffset, desc.name(), rowCount, query.profileId());
}
@Override
@@ -87,14 +87,14 @@ public final class SqlTreeBuilder {
this.temporalMode = SpiQuery.TemporalMode.of(query);
this.disableLazyLoad = query.isDisableLazyLoading();
this.readOnly = Boolean.TRUE.equals(query.isReadOnly());
this.subQuery = Type.SQ_EXISTS == query.getType()
|| Type.SQ_EX == query.getType()
|| Type.ID_LIST == query.getType()
|| Type.DELETE == query.getType()
this.subQuery = Type.SQ_EXISTS == query.type()
|| Type.SQ_EX == query.type()
|| Type.ID_LIST == query.type()
|| Type.DELETE == query.type()
|| query.isCountDistinct();
this.includeJoin = query.getM2mIncludeJoin();
this.manyWhereJoins = query.getManyWhereJoins();
this.queryDetail = query.getDetail();
this.includeJoin = query.m2mIncludeJoin();
this.manyWhereJoins = query.manyWhereJoins();
this.queryDetail = query.detail();
this.predicates = predicates;
this.alias = new SqlTreeAlias(request.baseTableAlias(), temporalMode);
this.distinctOnPlatform = builder.isPlatformDistinctOn();
@@ -138,7 +138,7 @@ public final class SqlTreeBuilder {
if (rawSql) {
return "Not Used";
}
if (query.getType() == Type.SQ_EXISTS) {
if (query.type() == Type.SQ_EXISTS) {
// effective query is "where exists (select 1 from ...)"
return "1";
}
@@ -147,7 +147,7 @@ public final class SqlTreeBuilder {
}
private String buildGroupByClause() {
if (rawSql || (!rootNode.isAggregation() && query.getHavingExpressions() == null)) {
if (rawSql || (!rootNode.isAggregation() && query.havingExpressions() == null)) {
return null;
}
ctx.startGroupBy();
@@ -156,7 +156,7 @@ public final class SqlTreeBuilder {
}
private String buildDistinctOn() {
if (rawSql || !distinctOnPlatform || !sqlDistinct || Type.COUNT == query.getType()) {
if (rawSql || !distinctOnPlatform || !sqlDistinct || Type.COUNT == query.type()) {
return null;
}
ctx.startGroupBy();
@@ -214,7 +214,7 @@ public final class SqlTreeBuilder {
if (!rawSql) {
alias.addJoin(queryDetail.getFetchPaths(), desc);
alias.addJoin(predicates.predicateIncludes(), desc);
alias.addManyWhereJoins(manyWhereJoins.getPropertyNames());
alias.addManyWhereJoins(manyWhereJoins.propertyNames());
// build set of table alias
alias.buildAlias();
predicates.parseTableAlias(alias);
@@ -259,7 +259,7 @@ public final class SqlTreeBuilder {
extraProps.forEach(props::addExtra);
if (!rawSql && manyWhereJoins.isFormulaWithJoin(prefix)) {
for (String property : manyWhereJoins.getFormulaJoinProperties(prefix)) {
for (String property : manyWhereJoins.formulaJoinProperties(prefix)) {
final STreeProperty beanProperty = desc.findPropertyFromPath(property);
myJoinList.add(new SqlTreeNodeFormulaWhereJoin(beanProperty, SqlJoinType.OUTER, null));
}
@@ -283,15 +283,15 @@ public final class SqlTreeBuilder {
* </p>
*/
private void addManyWhereJoins(List<SqlTreeNode> myJoinList) {
Collection<PropertyJoin> includes = manyWhereJoins.getPropertyJoins();
Collection<PropertyJoin> includes = manyWhereJoins.propertyJoins();
for (PropertyJoin joinProp : includes) {
STreePropertyAssoc beanProperty = (STreePropertyAssoc) desc.findPropertyFromPath(joinProp.getProperty());
SqlTreeNodeManyWhereJoin nodeJoin = new SqlTreeNodeManyWhereJoin(joinProp.getProperty(), beanProperty, joinProp.getSqlJoinType(), temporalMode);
STreePropertyAssoc beanProperty = (STreePropertyAssoc) desc.findPropertyFromPath(joinProp.property());
SqlTreeNodeManyWhereJoin nodeJoin = new SqlTreeNodeManyWhereJoin(joinProp.property(), beanProperty, joinProp.sqlJoinType(), temporalMode);
myJoinList.add(nodeJoin);
if (manyWhereJoins.isFormulaWithJoin(joinProp.getProperty())) {
for (String property : manyWhereJoins.getFormulaJoinProperties(joinProp.getProperty())) {
STreeProperty beanProperty2 = desc.findPropertyFromPath(SplitName.add(joinProp.getProperty(), property));
myJoinList.add(new SqlTreeNodeFormulaWhereJoin(beanProperty2, SqlJoinType.OUTER, joinProp.getProperty()));
if (manyWhereJoins.isFormulaWithJoin(joinProp.property())) {
for (String property : manyWhereJoins.formulaJoinProperties(joinProp.property())) {
STreeProperty beanProperty2 = desc.findPropertyFromPath(SplitName.add(joinProp.property(), property));
myJoinList.add(new SqlTreeNodeFormulaWhereJoin(beanProperty2, SqlJoinType.OUTER, joinProp.property()));
}
}
}
@@ -302,10 +302,10 @@ public final class SqlTreeBuilder {
buildExtraJoins(desc, myList);
// Optional many property for lazy loading query
STreePropertyAssocMany lazyLoadMany = (query == null) ? null : query.getLazyLoadMany();
STreePropertyAssocMany lazyLoadMany = (query == null) ? null : query.lazyLoadMany();
boolean withId = !rawNoId && !subQuery && (query == null || query.isWithId());
String baseTable = (query == null) ? null : query.getBaseTable();
String baseTable = (query == null) ? null : query.baseTable();
if (baseTable == null) {
baseTable = desc.baseTable(temporalMode);
}
@@ -356,7 +356,7 @@ public final class SqlTreeBuilder {
// support the predicates or order by clauses.
// remove ManyWhereJoins from the predicateIncludes
predicateIncludes.removeAll(manyWhereJoins.getPropertyNames());
predicateIncludes.removeAll(manyWhereJoins.propertyNames());
predicateIncludes.addAll(predicates.orderByIncludes());
// look for predicateIncludes that are not in selectIncludes and add
@@ -626,7 +626,7 @@ public final class SqlTreeBuilder {
// add many where joins
if (manyWhereJoins.isFormulaWithJoin(includeProp)) {
for (String property : manyWhereJoins.getFormulaJoinProperties(includeProp)) {
for (String property : manyWhereJoins.formulaJoinProperties(includeProp)) {
STreeProperty beanProperty = desc.findPropertyFromPath(SplitName.add(includeProp, property));
extraJoin.addChild(new SqlTreeNodeFormulaWhereJoin(beanProperty, SqlJoinType.OUTER, null));
}
@@ -48,8 +48,8 @@ public final class DefaultDtoQuery<T> extends AbstractQuery implements SpiDtoQue
this.server = server;
this.descriptor = descriptor;
this.ormQuery = ormQuery;
this.label = ormQuery.getLabel();
this.profileLocation = ormQuery.getProfileLocation();
this.label = ormQuery.label();
this.profileLocation = ormQuery.profileLocation();
}
/**
@@ -68,7 +68,7 @@ public final class DefaultDtoQuery<T> extends AbstractQuery implements SpiDtoQue
}
@Override
public DtoQueryPlan getQueryPlan(Object planKey) {
public DtoQueryPlan queryPlan(Object planKey) {
return descriptor.queryPlan(planKey);
}
@@ -205,17 +205,17 @@ public final class DefaultDtoQuery<T> extends AbstractQuery implements SpiDtoQue
}
@Override
public Class<T> getType() {
public Class<T> type() {
return descriptor.type();
}
@Override
public SpiQuery<?> getOrmQuery() {
public SpiQuery<?> ormQuery() {
return ormQuery;
}
@Override
public Transaction getTransaction() {
public Transaction transaction() {
return transaction;
}
@@ -243,7 +243,7 @@ public final class DefaultDtoQuery<T> extends AbstractQuery implements SpiDtoQue
@Nullable
@Override
public String getPlanLabel() {
public String planLabel() {
if (label != null) {
return label;
}
@@ -267,7 +267,7 @@ public final class DefaultDtoQuery<T> extends AbstractQuery implements SpiDtoQue
}
@Override
public ProfileLocation getProfileLocation() {
public ProfileLocation profileLocation() {
return profileLocation;
}
@@ -189,7 +189,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final BeanDescriptor<T> getBeanDescriptor() {
public final BeanDescriptor<T> descriptor() {
return beanDescriptor;
}
@@ -222,8 +222,8 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getProfileId() {
return getPlanLabel();
public final String profileId() {
return planLabel();
}
@Override
@@ -233,12 +233,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getLabel() {
public final String label() {
return label;
}
@Override
public final String getPlanLabel() {
public final String planLabel() {
if (label != null) {
return label;
}
@@ -291,7 +291,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final List<String> getSoftDeletePredicates() {
public final List<String> softDeletePredicates() {
return softDeletePredicates;
}
@@ -364,7 +364,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final SpiRawSql getRawSql() {
public final SpiRawSql rawSql() {
return rawSql;
}
@@ -384,7 +384,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final int getLazyLoadBatchSize() {
public final int lazyLoadBatchSize() {
return lazyLoadBatchSize;
}
@@ -395,7 +395,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getLazyLoadProperty() {
public final String lazyLoadProperty() {
return lazyLoadProperty;
}
@@ -432,7 +432,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
* Return the extra joins required to support the where clause for 'Many' properties.
*/
@Override
public final ManyWhereJoins getManyWhereJoins() {
public final ManyWhereJoins manyWhereJoins() {
return manyWhereJoins;
}
@@ -524,7 +524,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final Object getTenantId() {
public final Object tenantId() {
return tenantId;
}
@@ -539,7 +539,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final OrmQueryDetail getDetail() {
public final OrmQueryDetail detail() {
return detail;
}
@@ -617,7 +617,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final CountDistinctOrder getCountDistinctOrder() {
public final CountDistinctOrder countDistinctOrder() {
return countDistinctOrder;
}
@@ -634,7 +634,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
if (whereExpressions == null) {
return null;
}
List<SpiExpression> underlyingList = whereExpressions.getUnderlyingList();
List<SpiExpression> underlyingList = whereExpressions.underlyingList();
if (underlyingList.isEmpty()) {
if (id != null) {
return new CacheIdLookupSingle<>(id);
@@ -664,7 +664,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
NaturalKeyQueryData<T> data = new NaturalKeyQueryData<>(naturalKey);
for (SpiExpression expression : whereExpressions.getUnderlyingList()) {
for (SpiExpression expression : whereExpressions.underlyingList()) {
// must be eq or in
if (!expression.naturalKey(data)) {
return null;
@@ -674,10 +674,10 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final NaturalKeyBindParam getNaturalKeyBindParam() {
public final NaturalKeyBindParam naturalKeyBindParam() {
NaturalKeyBindParam namedBind = null;
if (bindParams != null) {
namedBind = bindParams.getNaturalKeyBindParam();
namedBind = bindParams.naturalKeyBindParam();
if (namedBind == null) {
return null;
}
@@ -765,12 +765,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final PersistenceContextScope getPersistenceContextScope() {
public final PersistenceContextScope persistenceContextScope() {
return persistenceContextScope;
}
@Override
public final Type getType() {
public final Type type() {
return type;
}
@@ -780,12 +780,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getLoadDescription() {
public final String loadDescription() {
return loadDescription;
}
@Override
public final String getLoadMode() {
public final String loadMode() {
return loadMode;
}
@@ -803,7 +803,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
* </p>
*/
@Override
public final PersistenceContext getPersistenceContext() {
public final PersistenceContext persistenceContext() {
return persistenceContext;
}
@@ -825,7 +825,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final BeanPropertyAssocMany<?> getLazyLoadMany() {
public final BeanPropertyAssocMany<?> lazyLoadMany() {
return lazyLoadForParentsProperty;
}
@@ -913,7 +913,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final ProfilingListener getProfilingListener() {
public final ProfilingListener profilingListener() {
return profilingListener;
}
@@ -936,12 +936,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final Mode getMode() {
public final Mode mode() {
return mode;
}
@Override
public final TemporalMode getTemporalMode() {
public final TemporalMode temporalMode() {
return temporalMode;
}
@@ -981,7 +981,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final ObjectGraphNode getParentNode() {
public final ObjectGraphNode parentNode() {
return parentNode;
}
@@ -1113,12 +1113,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getNativeSql() {
public final String nativeSql() {
return nativeSql;
}
@Override
public final Object getQueryPlanKey() {
public final Object queryPlanKey() {
return queryPlanKey;
}
@@ -1197,7 +1197,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
* Return the timeout.
*/
@Override
public final int getTimeout() {
public final int timeout() {
return timeout;
}
@@ -1212,12 +1212,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final Timestamp getVersionStart() {
public final Timestamp versionStart() {
return versionsStart;
}
@Override
public final Timestamp getVersionEnd() {
public final Timestamp versionEnd() {
return versionsEnd;
}
@@ -1255,12 +1255,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final CacheMode getUseBeanCache() {
public final CacheMode beanCacheMode() {
return useBeanCache;
}
@Override
public final CacheMode getUseQueryCache() {
public final CacheMode queryCacheMode() {
return useQueryCache;
}
@@ -1701,7 +1701,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final TableJoin getM2mIncludeJoin() {
public final TableJoin m2mIncludeJoin() {
return m2mIncludeJoin;
}
@@ -1744,7 +1744,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getMapKey() {
public final String mapKey() {
return mapKey;
}
@@ -1769,7 +1769,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final BindParams getBindParams() {
public final BindParams bindParams() {
return bindParams;
}
@@ -1826,17 +1826,17 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final SpiExpressionList<T> getHavingExpressions() {
public final SpiExpressionList<T> havingExpressions() {
return havingExpressions;
}
@Override
public final SpiExpressionList<T> getWhereExpressions() {
public final SpiExpressionList<T> whereExpressions() {
return whereExpressions;
}
@Override
public final SpiExpressionList<T> getTextExpression() {
public final SpiExpressionList<T> textExpression() {
return textExpressions;
}
@@ -1881,7 +1881,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final int getBufferFetchSizeHint() {
public final int bufferFetchSizeHint() {
return bufferFetchSizeHint;
}
@@ -1912,7 +1912,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final ReadEvent getFutureFetchAudit() {
public final ReadEvent futureFetchAudit() {
return futureFetchAudit;
}
@@ -1923,7 +1923,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getBaseTable() {
public final String baseTable() {
return baseTable;
}
@@ -1934,7 +1934,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final String getAlias() {
public final String alias() {
return rootTableAlias;
}
@@ -1966,7 +1966,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
validation.validate(property.getProperty());
}
}
return validation.getUnknownProperties();
return validation.unknownProperties();
}
final void setUpdateProperties(OrmUpdateProperties updateProperties) {
@@ -1974,12 +1974,12 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
}
@Override
public final OrmUpdateProperties getUpdateProperties() {
public final OrmUpdateProperties updateProperties() {
return updateProperties;
}
@Override
public final ProfileLocation getProfileLocation() {
public final ProfileLocation profileLocation() {
return profileLocation;
}
@@ -51,7 +51,7 @@ public final class DefaultOrmUpdate<T> implements SpiUpdate<T>, Serializable {
}
@Override
public Class<?> getBeanType() {
public Class<?> beanType() {
return beanType;
}
@@ -59,7 +59,7 @@ public final class DefaultOrmUpdate<T> implements SpiUpdate<T>, Serializable {
* Return the timeout in seconds.
*/
@Override
public int getTimeout() {
public int timeout() {
return timeout;
}
@@ -127,12 +127,12 @@ public final class DefaultOrmUpdate<T> implements SpiUpdate<T>, Serializable {
}
@Override
public String getLabel() {
public String label() {
return label;
}
@Override
public String getUpdateStatement() {
public String updateStatement() {
return updateStatement;
}
@@ -188,7 +188,7 @@ public final class DefaultOrmUpdate<T> implements SpiUpdate<T>, Serializable {
* Return the bind parameters.
*/
@Override
public BindParams getBindParams() {
public BindParams bindParams() {
return bindParams;
}
@@ -203,12 +203,12 @@ public final class DefaultOrmUpdate<T> implements SpiUpdate<T>, Serializable {
}
@Override
public String getBaseTable() {
public String baseTable() {
return baseTable;
}
@Override
public OrmUpdateType getOrmUpdateType() {
public OrmUpdateType ormUpdateType() {
return type;
}
@@ -19,7 +19,7 @@ public final class DefaultUpdateQuery<T> implements UpdateQuery<T> {
public DefaultUpdateQuery(DefaultOrmQuery<T> query) {
this.query = query;
this.descriptor = query.getBeanDescriptor();
this.descriptor = query.descriptor();
query.setUpdateProperties(values);
}
@@ -231,7 +231,7 @@ public final class OrmQueryProperties implements Serializable {
if (filterMany != null) {
filterMany.applyRowLimits(query);
SpiExpressionList<?> trimPath = filterMany.trimPath(path.length() + 1);
for (SpiExpression spiExpression : trimPath.getUnderlyingList()) {
for (SpiExpression spiExpression : trimPath.underlyingList()) {
query.where().add(spiExpression);
}
}
@@ -24,7 +24,7 @@ final class OrmQuerySecondary implements SpiQuerySecondary {
* Return a list of path/properties that are query join loaded.
*/
@Override
public List<OrmQueryProperties> getQueryJoins() {
public List<OrmQueryProperties> queryJoins() {
return queryJoins;
}
@@ -32,7 +32,7 @@ final class OrmQuerySecondary implements SpiQuerySecondary {
* Return the list of path/properties that are lazy loaded.
*/
@Override
public List<OrmQueryProperties> getLazyJoins() {
public List<OrmQueryProperties> lazyJoins() {
return lazyJoins;
}
}
@@ -30,7 +30,7 @@ public final class DocStoreOnlyTransaction extends JdbcTransaction {
}
@Override
public Connection getInternalConnection() {
public Connection internalConnection() {
throw new RuntimeException("not supported on DocStoreTransaction");
}
@@ -80,7 +80,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public long getStartNanoTime() {
public long startNanoTime() {
// not used on read only transaction
return startNanos;
}
@@ -101,7 +101,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public String getLabel() {
public String label() {
return null;
}
@@ -131,7 +131,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public ProfileLocation getProfileLocation() {
public ProfileLocation profileLocation() {
return profileLocation;
}
@@ -175,7 +175,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public DocStoreMode getDocStoreMode() {
public DocStoreMode docStoreMode() {
return null;
}
@@ -362,7 +362,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public BatchControl getBatchControl() {
public BatchControl batchControl() {
return null;
}
@@ -387,7 +387,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
* Return the persistence context associated with this transaction.
*/
@Override
public SpiPersistenceContext getPersistenceContext() {
public SpiPersistenceContext persistenceContext() {
return persistenceContext;
}
@@ -407,7 +407,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public TransactionEvent getEvent() {
public TransactionEvent event() {
throw new IllegalStateException(notExpectedMessage);
}
@@ -448,7 +448,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
* Return the transaction id.
*/
@Override
public String getId() {
public String id() {
return null;
}
@@ -458,7 +458,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public Object getTenantId() {
public Object tenantId() {
return tenantId;
}
@@ -466,7 +466,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
* Return the underlying connection for internal use.
*/
@Override
public Connection getInternalConnection() {
public Connection internalConnection() {
if (!active) {
throw new IllegalStateException(illegalStateMessage);
}
@@ -478,7 +478,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
*/
@Override
public Connection connection() {
return getInternalConnection();
return internalConnection();
}
private void deactivate() {
@@ -608,7 +608,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
}
@Override
public DocStoreTransaction getDocStoreTransaction() {
public DocStoreTransaction docStoreTransaction() {
throw new IllegalStateException(notExpectedMessage);
}
@@ -136,12 +136,12 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
}
@Override
public final String getLabel() {
public final String label() {
return label;
}
@Override
public final long getStartNanoTime() {
public final long startNanoTime() {
return startNanos;
}
@@ -173,7 +173,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
}
@Override
public final ProfileLocation getProfileLocation() {
public final ProfileLocation profileLocation() {
return profileLocation;
}
@@ -300,7 +300,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
}
@Override
public final DocStoreMode getDocStoreMode() {
public final DocStoreMode docStoreMode() {
return docStoreMode;
}
@@ -609,7 +609,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
}
@Override
public final BatchControl getBatchControl() {
public final BatchControl batchControl() {
return batchControl;
}
@@ -667,7 +667,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
* Return the persistence context associated with this transaction.
*/
@Override
public final SpiPersistenceContext getPersistenceContext() {
public final SpiPersistenceContext persistenceContext() {
return persistenceContext;
}
@@ -687,7 +687,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
* Return the underlying TransactionEvent.
*/
@Override
public final TransactionEvent getEvent() {
public final TransactionEvent event() {
queryOnly = false;
if (event == null) {
event = new TransactionEvent();
@@ -732,7 +732,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
* Return the transaction id.
*/
@Override
public final String getId() {
public final String id() {
return id;
}
@@ -742,7 +742,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
}
@Override
public final Object getTenantId() {
public final Object tenantId() {
return tenantId;
}
@@ -750,7 +750,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
* Return the underlying connection for internal use.
*/
@Override
public Connection getInternalConnection() {
public Connection internalConnection() {
return connection;
}
@@ -760,7 +760,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
@Override
public Connection connection() {
queryOnly = false;
return getInternalConnection();
return internalConnection();
}
void deactivate() {
@@ -1085,11 +1085,11 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
@Override
public final void addModification(String tableName, boolean inserts, boolean updates, boolean deletes) {
getEvent().add(tableName, inserts, updates, deletes);
event().add(tableName, inserts, updates, deletes);
}
@Override
public final DocStoreTransaction getDocStoreTransaction() {
public final DocStoreTransaction docStoreTransaction() {
if (docStoreTxn == null) {
queryOnly = false;
docStoreTxn = manager.createDocStoreTransaction(docStoreBatchSize);
@@ -89,7 +89,7 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
SpiTransaction currentEbeanTransaction = scope.inScope();
if (currentEbeanTransaction != null) {
// NOT expecting this so log WARNING
log.log(WARNING, "JTA Transaction - no current txn BUT using current Ebean one {0}", currentEbeanTransaction.getId());
log.log(WARNING, "JTA Transaction - no current txn BUT using current Ebean one {0}", currentEbeanTransaction.id());
return currentEbeanTransaction;
}
@@ -182,25 +182,25 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
public void afterCompletion(int status) {
switch (status) {
case Status.STATUS_COMMITTED:
log.log(DEBUG, "Jta Txn [{0}] committed", transaction.getId());
log.log(DEBUG, "Jta Txn [{0}] committed", transaction.id());
transaction.postCommit();
// Remove this transaction object as it is completed
transactionManager.scope().clearExternal();
break;
case Status.STATUS_ROLLEDBACK:
log.log(DEBUG, "Jta Txn [{0}] rollback", transaction.getId());
log.log(DEBUG, "Jta Txn [{0}] rollback", transaction.id());
transaction.postRollback(null);
// Remove this transaction object as it is completed
transactionManager.scope().clearExternal();
break;
default:
log.log(DEBUG, "Jta Txn [{0}] status:{1}", transaction.getId(), status);
log.log(DEBUG, "Jta Txn [{0}] status:{1}", transaction.id(), status);
}
// No matter the completion status of the transaction, we release the connection we got from the pool.
JdbcClose.close(transaction.getInternalConnection());
JdbcClose.close(transaction.internalConnection());
}
}
@@ -41,7 +41,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public String getLabel() {
public String label() {
return null;
}
@@ -56,7 +56,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public long getStartNanoTime() {
public long startNanoTime() {
// not used
return System.nanoTime();
}
@@ -168,7 +168,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public String getId() {
public String id() {
return null;
}
@@ -178,7 +178,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public DocStoreMode getDocStoreMode() {
public DocStoreMode docStoreMode() {
return null;
}
@@ -317,7 +317,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public TransactionEvent getEvent() {
public TransactionEvent event() {
return null;
}
@@ -332,7 +332,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public BatchControl getBatchControl() {
public BatchControl batchControl() {
return null;
}
@@ -341,7 +341,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public SpiPersistenceContext getPersistenceContext() {
public SpiPersistenceContext persistenceContext() {
return null;
}
@@ -350,7 +350,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public Connection getInternalConnection() {
public Connection internalConnection() {
return null;
}
@@ -398,7 +398,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public DocStoreTransaction getDocStoreTransaction() {
public DocStoreTransaction docStoreTransaction() {
return null;
}
@@ -407,7 +407,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public Object getTenantId() {
public Object tenantId() {
return null;
}
@@ -434,7 +434,7 @@ final class NoTransaction implements SpiTransaction {
}
@Override
public ProfileLocation getProfileLocation() {
public ProfileLocation profileLocation() {
return null;
}
}
@@ -46,8 +46,8 @@ final class PostCommitProcessing {
this.txnDocStoreMode = DocStoreMode.IGNORE;
this.txnDocStoreBatchSize = 0;
this.event = event;
this.deleteByIdMap = event.getDeleteByIdMap();
this.listenerNotify = event.getListenerNotify();
this.deleteByIdMap = event.deleteByIdMap();
this.listenerNotify = event.listenerNotify();
this.remoteTransactionEvent = createRemoteTransactionEvent();
}
@@ -58,11 +58,11 @@ final class PostCommitProcessing {
this.clusterManager = clusterManager;
this.manager = manager;
this.serverName = manager.name();
this.txnDocStoreMode = transaction.getDocStoreMode();
this.txnDocStoreMode = transaction.docStoreMode();
this.txnDocStoreBatchSize = transaction.getDocStoreBatchSize();
this.event = transaction.getEvent();
this.deleteByIdMap = event.getDeleteByIdMap();
this.listenerNotify = event.getListenerNotify();
this.event = transaction.event();
this.deleteByIdMap = event.deleteByIdMap();
this.listenerNotify = event.listenerNotify();
this.remoteTransactionEvent = createRemoteTransactionEvent();
}
@@ -149,7 +149,7 @@ final class PostCommitProcessing {
request.notifyLocalPersistListener();
}
}
TransactionEventTable eventTables = event.getEventTables();
TransactionEventTable eventTables = event.eventTables();
if (eventTables != null && !eventTables.isEmpty()) {
BulkEventListenerMap map = manager.bulkEventListenerMap();
for (TableIUD tableIUD : eventTables.values()) {
@@ -183,7 +183,7 @@ final class PostCommitProcessing {
if (deleteByIdMap != null) {
remoteTransactionEvent.setDeleteByIdMap(deleteByIdMap);
}
TransactionEventTable eventTables = event.getEventTables();
TransactionEventTable eventTables = event.eventTables();
if (eventTables != null && !eventTables.isEmpty()) {
for (TableIUD tableIUD : eventTables.values()) {
remoteTransactionEvent.addTableIUD(tableIUD);
@@ -30,7 +30,7 @@ final class SavepointTransaction extends SpiTransactionProxy {
SavepointTransaction(SpiTransaction transaction, TransactionManager manager) throws SQLException {
this.manager = manager;
this.transaction = transaction;
this.connection = transaction.getInternalConnection();
this.connection = transaction.internalConnection();
this.savepoint = connection.setSavepoint();
if (transaction.isLogSql()) {
int savepointId = manager.isSupportsSavepointId() ? savepoint.getSavepointId() : 0;
@@ -41,7 +41,7 @@ final class SavepointTransaction extends SpiTransactionProxy {
}
@Override
public TransactionEvent getEvent() {
public TransactionEvent event() {
if (event == null) {
event = new TransactionEvent();
}
@@ -35,7 +35,7 @@ abstract class TransactionFactory {
*/
final SpiTransaction setIsolationLevel(SpiTransaction t, boolean explicit, int isolationLevel) {
if (isolationLevel > -1) {
Connection connection = t.getInternalConnection();
Connection connection = t.internalConnection();
try {
connection.setTransactionIsolation(isolationLevel);
} catch (SQLException e) {
@@ -334,7 +334,7 @@ public class TransactionManager implements SpiTransactionManager {
public final void externalModification(TransactionEventTable tableEvent) {
SpiTransaction t = active();
if (t != null) {
t.getEvent().add(tableEvent);
t.event().add(tableEvent);
} else {
externalModificationEvent(tableEvent);
}
@@ -61,7 +61,7 @@ public final class BindParamsParser {
*/
private String parseSql() {
if (params.isSameBindHash()) {
String preparedSql = params.getPreparedSql();
String preparedSql = params.preparedSql();
if (preparedSql != null && !preparedSql.isEmpty()) {
// the sql has already been parsed and positionedParameters are set in order
return preparedSql;
@@ -117,7 +117,7 @@ public final class BindParamsParser {
Param param = extractNamedParam(paramName);
orderedList.appendSql(sql.substring(startPos, nameParamStart));
Object inValue = param.getInValue();
Object inValue = param.inValue();
if (inValue instanceof Collection<?>) {
addCollectionParams(orderedList, param, (Collection<?>) inValue);
} else {
@@ -139,7 +139,7 @@ public final class BindParamsParser {
if (paramName.startsWith(ENCRYPTKEY_PREFIX)) {
param = addEncryptKeyParam(paramName);
} else {
param = params.getParameter(paramName);
param = params.parameter(paramName);
}
if (param == null) {
throw new PersistenceException("Bind value is not set or null for " + paramName + " in " + sql);
@@ -27,7 +27,7 @@ public class DefaultServer_createOrmQueryRequestTest {
}
OrmQueryDetail detail(Query<Order> query) {
return queryRequest(query).query().getDetail();
return queryRequest(query).query().detail();
}
@Test
@@ -124,7 +124,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("details");
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer", "details");
}
@@ -138,7 +138,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.where().eq("customer.name", "rob").query();
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("details");
}
@@ -152,7 +152,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetchQuery("details");
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -166,7 +166,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetchQuery("details");
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -180,7 +180,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("details", FetchConfig.ofLazy());
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -194,7 +194,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetchLazy("details");
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -209,7 +209,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("details.product");
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -224,7 +224,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("customer", "name");
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("details", "details.product", "customer");
}
@@ -239,7 +239,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("customer", "name");
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -254,7 +254,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("customer.contacts"); // second many path
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("details", "details.product", "customer");
}
@@ -270,7 +270,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("customer.contacts"); // many path
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -286,7 +286,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.fetch("customer.contacts"); // many path
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer");
}
@@ -303,7 +303,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.query();
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("details", "details.product", "customer");
}
@@ -320,7 +320,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.query();
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer", "customer.contacts");
}
@@ -337,7 +337,7 @@ public class DefaultServer_createOrmQueryRequestTest {
.query();
OrmQueryRequest<Order> queryRequest = queryRequest(query);
OrmQueryDetail detail = queryRequest.query().getDetail();
OrmQueryDetail detail = queryRequest.query().detail();
assertThat(detail.getFetchPaths()).containsExactly("customer", "customer.contacts");
}
@@ -25,7 +25,7 @@ public class PrepareDocNestedTest extends BaseTest {
DefaultExpressionList<?> exp = (DefaultExpressionList<?>) where;
PrepareDocNested.prepare(exp, getBeanDescriptor(Order.class));
List<SpiExpression> underlyingList = exp.getUnderlyingList();
List<SpiExpression> underlyingList = exp.underlyingList();
assertEquals(underlyingList.size(), 1);
assertEquals(exp.allDocNestedPath, "details");
}
@@ -43,7 +43,7 @@ public class PrepareDocNestedTest extends BaseTest {
DefaultExpressionList<?> exp = (DefaultExpressionList<?>) where;
PrepareDocNested.prepare(exp, getBeanDescriptor(Order.class));
List<SpiExpression> underlyingList = exp.getUnderlyingList();
List<SpiExpression> underlyingList = exp.underlyingList();
assertEquals(underlyingList.size(), 2);
assertEquals(exp.allDocNestedPath, "details");
}
@@ -62,7 +62,7 @@ public class PrepareDocNestedTest extends BaseTest {
DefaultExpressionList<?> exp = (DefaultExpressionList<?>) where;
PrepareDocNested.prepare(exp, getBeanDescriptor(Order.class));
List<SpiExpression> underlyingList = exp.getUnderlyingList();
List<SpiExpression> underlyingList = exp.underlyingList();
assertEquals(underlyingList.size(), 2);
assertNull(exp.allDocNestedPath);
@@ -84,12 +84,12 @@ public class PrepareDocNestedTest extends BaseTest {
DefaultExpressionList<?> exp = (DefaultExpressionList<?>) where;
PrepareDocNested.prepare(exp, getBeanDescriptor(Order.class));
List<SpiExpression> underlyingList = exp.getUnderlyingList();
List<SpiExpression> underlyingList = exp.underlyingList();
assertEquals(underlyingList.size(), 1);
assertNull(exp.allDocNestedPath);
JunctionExpression<?> junction = (JunctionExpression<?>) underlyingList.get(0);
List<SpiExpression> junctionUnderlying = junction.exprList.getUnderlyingList();
List<SpiExpression> junctionUnderlying = junction.exprList.underlyingList();
JunctionExpression<?> nestedNestedPath = (JunctionExpression<?>) junctionUnderlying.get(1);
assertEquals(nestedNestedPath.exprList.allDocNestedPath, "details");
}
@@ -107,7 +107,7 @@ public class PrepareDocNestedTest extends BaseTest {
DefaultExpressionList<?> exp = (DefaultExpressionList<?>) where;
PrepareDocNested.prepare(exp, getBeanDescriptor(Order.class));
List<SpiExpression> underlyingList = exp.getUnderlyingList();
List<SpiExpression> underlyingList = exp.underlyingList();
assertEquals(underlyingList.size(), 2);
assertNull(exp.allDocNestedPath);
@@ -135,7 +135,7 @@ public class PrepareDocNestedTest extends BaseTest {
DefaultExpressionList<?> exp = (DefaultExpressionList<?>) where;
PrepareDocNested.prepare(exp, getBeanDescriptor(Order.class));
List<SpiExpression> underlyingList = exp.getUnderlyingList();
List<SpiExpression> underlyingList = exp.underlyingList();
assertEquals(underlyingList.size(), 5);
assertNull(exp.allDocNestedPath);
@@ -20,20 +20,20 @@ public class DefaultOrmQueryTest extends BaseExpressionTest {
DefaultOrmQuery<Customer> q1 = (DefaultOrmQuery<Customer>) DB.find(Customer.class)
.forUpdate().where().eq("id", 42).query();
assertThat(q1.getUseBeanCache()).isSameAs(CacheMode.OFF);
assertThat(q1.beanCacheMode()).isSameAs(CacheMode.OFF);
}
@Test
public void checkForId_when_eqId_then_translatedTo_setId() {
DefaultOrmQuery<Order> q1 = (DefaultOrmQuery<Order>) DB.find(Order.class).where().eq("id", 42).query();
assertThat(q1.getWhereExpressions()).isNotNull();
assertThat(q1.whereExpressions()).isNotNull();
assertThat(q1.getId()).isNull();
assertThat(q1.isFindById()).isTrue();
assertThat(q1.getId()).isEqualTo(42);
assertThat(q1.getWhereExpressions()).isNull();
assertThat(q1.whereExpressions()).isNull();
}
@Test
@@ -85,7 +85,7 @@ public class PBooleanTest {
private SimpleExpression getExpression(QCustomer customer) {
DefaultExpressionList<Customer> where = (DefaultExpressionList<Customer>)customer.query().where();
return (SimpleExpression)where.getUnderlyingList().get(0);
return (SimpleExpression)where.underlyingList().get(0);
}
@@ -145,12 +145,12 @@ public final class SpringJdbcTransactionManager implements ExternalTransactionMa
public void afterCompletion(int status) {
switch (status) {
case STATUS_COMMITTED:
log.log(DEBUG, "Spring Txn [{0}] committed", transaction.getId());
log.log(DEBUG, "Spring Txn [{0}] committed", transaction.id());
transaction.postCommit();
break;
case STATUS_ROLLED_BACK:
log.log(DEBUG, "Spring Txn [{0}] rollback", transaction.getId());
log.log(DEBUG, "Spring Txn [{0}] rollback", transaction.id());
transaction.postRollback(null);
break;
@@ -17,7 +17,7 @@ public class BindParamsTest {
List<String> ids = Arrays.asList("1", "2", "3");
bindParams.setParameter("ids", ids);
BindParams.Param param = bindParams.getParameter("ids");
BindParams.Param param = bindParams.parameter("ids");
assertEquals(3, param.queryBindCount());
assertFalse(bindParams.isSameBindHash());
bindParams.updateHash();
@@ -166,7 +166,7 @@ public class BeanTypeTest {
SpiQuery<Order> orderQuery = (SpiQuery<Order>) db.find(Order.class);
beanType(Order.class).docStore().applyPath(orderQuery);
OrmQueryDetail detail = orderQuery.getDetail();
OrmQueryDetail detail = orderQuery.detail();
assertThat(detail.getChunk("customer", false).getIncluded()).containsExactly("id", "name");
}
@@ -165,7 +165,7 @@ public class TestPersistenceContext extends BaseTestCase {
lastBean[0] = customer;
});
SpiPersistenceContext pc = ((SpiTransaction) txn).getPersistenceContext();
SpiPersistenceContext pc = ((SpiTransaction) txn).persistenceContext();
// the first 100 customers using strong references
assertThat(pc.toString()).contains("Customer=size:5000 (4900 weak)");
assertThat(pc.toString()).contains("Order=size:100 (100 weak)");
@@ -70,7 +70,7 @@ public class TestBatchInsertFlush extends BaseTestCase {
// detail
assertThat(sql.get(3)).contains("insert into t_detail_with_other_namexxxyy");
assertThat(((SpiTransaction)transaction).getLabel()).isEqualTo("TestBatchInsertFlush.no_cascade");
assertThat(((SpiTransaction)transaction).label()).isEqualTo("TestBatchInsertFlush.no_cascade");
} finally {
transaction.end();
@@ -96,7 +96,7 @@ public class TestBatchOnCascadeExceptionHandling extends BaseTestCase {
Assertions.fail("PersistenceException expected");
} catch (PersistenceException e) {
assertThat(txn.isBatchMode()).as("batch mode").isFalse(); // should not have changed
BatchControl bc = ((SpiTransaction) txn).getBatchControl();
BatchControl bc = ((SpiTransaction) txn).batchControl();
assertThat(bc == null || bc.isEmpty()).as("batch emtpy").isTrue();
} finally {
txn.end();
@@ -51,7 +51,7 @@ public class TestAutofetchTuneWithJoin extends BaseTestCase {
}
SpiQuery<?> sq = (SpiQuery<?>) q;
ObjectGraphNode parentNode = sq.getParentNode();
ObjectGraphNode parentNode = sq.parentNode();
ObjectGraphOrigin origin = parentNode.origin();
assertThat(origin).isNotNull();
// MetaAutoFetchStatistic metaAutoFetchStatistic =
@@ -123,7 +123,7 @@ public class TestQueryFindEach extends BaseTestCase {
.findList();
SpiTransaction spiTxn = (SpiTransaction) transaction;
PersistenceContext pc = spiTxn.getPersistenceContext();
PersistenceContext pc = spiTxn.persistenceContext();
assertThat(pc.size(Customer.class)).isEqualTo(customerList.size());
LoggedSql.start();
@@ -119,7 +119,7 @@ public class TestInsertSqlLogging extends BaseTestCase {
update.execute();
transaction.commit();
assertFalse(((SpiTransaction) transaction).getEvent().getEventTables().isEmpty());
assertFalse(((SpiTransaction) transaction).event().eventTables().isEmpty());
} finally {
transaction.end();

Some files were not shown because too many files have changed in this diff Show More