Compare commits

...
Author SHA1 Message Date
Rob Bygrave 08502d7315 [maven-release-plugin] prepare release ebean-parent-12.12.3 2021-10-21 21:36:21 +13:00
Rob Bygrave 6f4bc0ac2c Prepare release, comment out extra test modules 2021-10-21 21:33:16 +13:00
Rob Bygrave 5585866e82 Prepare release, comment out extra test modules 2021-10-21 14:07:27 +13:00
Rob Bygrave f21f6d9592 Prepare release, comment out extra test modules 2021-10-21 13:54:39 +13:00
Rob Bygrave 03e0519951 Refactor tidy internals for DefaultServer, rename descriptorManager 2021-10-21 13:41:58 +13:00
Rob Bygrave bc23d5829c Refactor tidy internals for DefaultPersister, BeanDescriptorManager etc 2021-10-21 13:30:32 +13:00
Rob Bygrave 64108aac40 #2424 Preserve using PersistenceException when transaction register(Callback) called with no active transaction 2021-10-21 12:12:02 +13:00
Rob Bygrave fcda419abb #2424 Preserve using PersistenceException when transaction register(Callback) called with no active transaction 2021-10-21 12:06:45 +13:00
Rob Bygrave 4d34c9e868 #2424 Change error for transaction register(Callback) when no active transaction from PersistenceException to NullPointerException
Ah ok, so in being more strict on null for currentTransaction() that shows up the code that registers transaction callbacks as checking for null and throwing PersistenceException. This is inconsistent with LOTS of other methods that use currentTransaction() and would result in NPE.

The concept here is that PersistenceException for this case isn't better than NPE and NPE is actually more consistence wrt using currentTransaction().
2021-10-21 12:02:42 +13:00
Rob Bygrave 5178b76431 Update internals migrate from deprecated methods baseTable() 2021-10-20 20:07:54 +13:00
Rob Bygrave 8fb02662e6 #2423 Add @Nullable on single bean publish and restore by id 2021-10-20 20:06:59 +13:00
Rob Bygrave 1aac63771d #2423 Tidy up DefaultServer internals getting descriptor 2021-10-20 19:58:11 +13:00
Rob Bygrave 3a138c3462 Tidy internals only - improve DefaultServer parameter names 2021-10-20 16:07:43 +13:00
Rob Bygrave 30088f4de7 #2423 Tidy up DefaultServer internals with Objects.requireNonNull() 2021-10-20 15:53:50 +13:00
Rob BygraveandGitHub cc272bb950 Merge pull request #2423 from ebean-orm/feature/nonNullApi
Use @NonNullApi to explicitly reflect non-null return types and params by default
2021-10-20 15:47:44 +13:00
Rob Bygrave b3ee982b64 Use @NonNullApi to explicitly reflect non-null return types and params by default 2021-10-20 15:45:20 +13:00
Rob Bygrave 92a13ad265 Remove pom releaseBackup files that should not be there 2021-10-20 09:52:06 +13:00
Rob Bygrave a445557ec3 #2422 - Remove extraneous jsr 305 @Nonnull 2021-10-19 17:59:25 +13:00
Rob Bygrave c7bb027c7d #2422 - Remove extraneous jsr 305 @Nonnull 2021-10-19 17:33:23 +13:00
Rob Bygrave 709eb369c9 #2419 - Add explicit @Nullable on findOne() methods 2021-10-19 12:12:11 +13:00
Rob Bygrave 5a4924b6cb #2421 - Change database.diff() to return empty map rather than null with null bean argument 2021-10-19 11:58:29 +13:00
Rob Bygrave a61c73c62a #2418 #2420 BeanState.loadErrors() returns empty map
Change Database.beanState() to throw IllegalArgumentException when bean isn't an entity bean
2021-10-19 11:52:36 +13:00
Rob Bygrave 7862648b83 #2419 - Add explicit @Nullable on findOne() methods 2021-10-19 11:50:22 +13:00
Rob Bygrave fa252a1fe4 Javadoc for #2303 - bump to pgjdbc 42.3.0 2021-10-19 11:23:26 +13:00
Rob Bygrave add7a8c4ba Javadoc for #2303 - bump to pgjdbc 42.2.25
Noting that this version of pgjdbc has not been released yet. Guessing that this is the next release number.
2021-10-14 14:49:15 +13:00
Rob Bygrave 834c04bd33 Update Postgres test dependency only (#2303) 2021-10-13 09:45:00 +13:00
Rob Bygrave 9bda4ab5c7 #2303 - Add javadoc for notes on Postgres with "allQuotedIdentifiers = true" 2021-10-13 09:37:40 +13:00
Rob Bygrave d1ca7a30dc Merge branch 'FOCONIS-tidy-remove-readjson-resetContext' 2021-10-12 15:11:35 +13:00
Rob Bygrave cb67dd0f29 Merge branch 'tidy-remove-readjson-resetContext' of https://github.com/FOCONIS/ebean into FOCONIS-tidy-remove-readjson-resetContext 2021-10-12 15:11:23 +13:00
Rob Bygrave e173f6e9a9 Tidy only DefaultPersistenceContext after merge of #2411 2021-10-12 15:10:36 +13:00
Rob BygraveandGitHub 349cd01921 Merge pull request #2411 from ebean-orm/feature/weak-reference-persistence-context
Weak reference based persistence context for streaming queries
2021-10-12 14:39:47 +13:00
Rob BygraveandGitHub 8fa7fa6af3 Merge pull request #2413 from FOCONIS/feature/weak-reference-persistence-context
Change DefaultPersistenceContect to use beginIterate / endIterate
2021-10-12 14:34:05 +13:00
Rob Bygrave caf18565a0 [maven-release-plugin] prepare for next development iteration 2021-10-12 12:46:15 +13:00
Rob Bygrave c89d39ec2d [maven-release-plugin] prepare release ebean-parent-12.12.2 2021-10-12 12:46:08 +13:00
Rob Bygrave 556557276c Bump ebean-agent version 2021-10-12 12:38:08 +13:00
Roland Praml 2f277938e5 Remove LoadContext.resetPersistenceContext 2021-10-11 17:48:09 +02:00
Roland Praml 5322ab3e7e Remove: ReadJson.resetContext as it is not used 2021-10-11 17:22:33 +02:00
Roland Praml 100832ddd9 Changed test to test pc.beginIterate / endIterate 2021-10-11 17:16:34 +02:00
Roland Praml 3f5009aa91 Use WeakReferences when in iterate query mode 2021-10-11 16:25:21 +02:00
Roland Praml 8dbd290119 Remove: ReadJson.resetContext as it is not used 2021-10-11 13:40:03 +02:00
Rob Bygrave ea3fb833a4 Weak reference based PersistenceContext for streaming queries 2021-10-11 22:48:18 +13:00
Rob Bygrave 0273e1c2c8 Modify test TestUpdate to ensure basic test data is loaded first 2021-10-11 12:13:02 +13:00
Rob Bygrave 8440a13b0f Refactor rename internal method DefaultPersistenceContext.classContext() 2021-10-11 11:36:38 +13:00
Rob Bygrave c5e940733c #2408 Followup refactor BindParamsParser extract methods 2021-10-11 11:21:28 +13:00
Rob BygraveandGitHub ac73031bec Merge pull request #2408 from FOCONIS/pr/bugfix/reuse_update_collection_parameters
Fix reuse of io.ebean.Update when using setParameter with Collection
2021-10-11 11:01:23 +13:00
Rob Bygrave a65ff8a650 Tidy test only - TestOneToManyCorrectGrouping 2021-10-08 12:55:50 +13:00
Rob Bygrave f904fea104 Tidy, remove unnecessary --add-opens test clause for eban-querybean testing 2021-10-08 12:55:22 +13:00
Rob Bygrave 2549eace09 #2406 - Memory leak in Query.findEach 2021-10-08 11:20:54 +13:00
Jonas Pöhler a592717c77 Merge remote-tracking branch 'ebean/master' into pr/bugfix/reuse_update_collection_parameters 2021-10-06 11:57:50 +02:00
Jonas Pöhler db6f93e383 FIX: Reuse of io.ebean.Update with collection parameters did not work correctly 2021-10-06 11:57:09 +02:00
Rob Bygrave 0a0d67585c [maven-release-plugin] prepare for next development iteration 2021-10-05 10:50:00 +13:00
Rob Bygrave db2f8cd811 [maven-release-plugin] prepare release ebean-parent-12.12.1 2021-10-05 10:49:53 +13:00
Rob Bygrave b6e524f879 Disable test modules for release 2021-10-05 10:47:23 +13:00
Rob Bygrave 40492f487c #2404 - Initializing @OneToMany with mutableListOf() in Kotlin results in ClassCastException 2021-10-05 10:17:44 +13:00
Rob Bygrave 2cee03bc4b #172 Bump ebean-agent via maven plugin
The associated ebean-agent has the fix for the kotlin specific #172 issue.
2021-10-04 22:57:24 +13:00
Rob BygraveandGitHub e2c6125501 Merge pull request #2402 from ebean-orm/feature/ebean-agent-min-version
Modify EbeanVersion to check for minimum ebean-agent version
2021-09-30 10:42:33 +13:00
Rob Bygrave b53221fc0e Modify EbeanVersion to check for minimum ebean-agent version 2021-09-29 12:20:27 +13:00
Rob Bygrave b23551ce43 #2401 - Fix EbeanVersion for use in module-path (reads local ebean-api pom.properties) 2021-09-29 11:14:26 +13:00
Rob Bygrave 3971ccea1a Merge branch 'master' of github.com:ebean-orm/ebean 2021-09-29 11:11:55 +13:00
Rob BygraveandGitHub 35b1f835c5 Merge pull request #2400 from focbenz/patch-1
Update README.md typo fix Maven central
2021-09-29 09:47:28 +13:00
Michael BenzandGitHub ef5e3a796d Update README.md typo fix Maven central
typo fix Maven central
2021-09-28 20:02:12 +02:00
Rob Bygrave d3dbde4e79 Add a dummy placeholder so that we can sync to maven central
The sync needs javadoc and sources so adding a dummy class. Note that I think we only just got this due to the multi-version jar but not sure.
2021-09-24 21:42:23 +12:00
Rob Bygrave 033c579984 #2398 - Fix compiler warning for annotation processing query bean generators 2021-09-24 17:51:36 +12:00
Rob Bygrave 1a34a56351 [maven-release-plugin] prepare for next development iteration 2021-09-24 10:12:14 +12:00
Rob Bygrave edfdbd56b1 [maven-release-plugin] prepare release ebean-parent-12.12.0 2021-09-24 10:12:07 +12:00
Rob Bygrave 8f94072afd Log error when ebean-ddl-generator not in classpath but ddlRun is true 2021-09-23 22:32:01 +12:00
Rob Bygrave d028b200fa Log error when ebean-ddl-generator not in classpath but ddlRun is true 2021-09-23 22:28:01 +12:00
Rob Bygrave 9af006b15b Update tests only for Oracle 2021-09-23 18:49:28 +12:00
Rob Bygrave 35a6ff7f02 #2392 - Oracle specific singleAttribute distinct query - not include the column twice with order by clause 2021-09-23 18:48:40 +12:00
Rob Bygrave cebac8040f #2391 - MySql specific NPE because the return value of "java.sql.ResultSetMetaData.getTableName(int)" is null 2021-09-23 17:20:59 +12:00
Rob Bygrave e8524c5b1a Fix tests only - fix tests for SqlServer 2021-09-23 17:07:35 +12:00
Rob Bygrave 3244314424 #2390 - Tidy generated SQL removing excess whitespace after id = ? predicate 2021-09-23 16:42:45 +12:00
Rob Bygrave 0a4c26965c No effective change - tidy whitespace in CQueryBuilder 2021-09-23 16:36:20 +12:00
Rob Bygrave 6238243c91 No effective change - tidy whitespace in CQueryBuilderRawSql 2021-09-23 16:35:35 +12:00
Rob Bygrave c1d7e77d85 No effective change - tidy whitespace in DtoMeta etc 2021-09-23 16:31:29 +12:00
Rob Bygrave 5b07309f51 #2389 - redis.clients.jedis.exceptions.JedisDataException: ERR wrong number of arguments for 'mget' command 2021-09-23 15:41:33 +12:00
Rob Bygrave 8ee67410f9 #2387 - Additionally support setIdIn(Collection<?> ids)
Add overloaded method taking Collection of id values.
2021-09-23 15:32:40 +12:00
Rob Bygrave dec114028f #2388 - Bump dependencies ebean-migration, classpath-scanner, avaje-config 2021-09-23 15:01:43 +12:00
Rob Bygrave 477e7eeeda #2387 - Hit the L2 bean cache via property IN expression (when property is the id property) 2021-09-23 00:23:23 +12:00
Rob Bygrave c9c61d9f97 #2386 - Fix test with logging change 2021-09-23 00:13:53 +12:00
Rob Bygrave d0909ad140 #2385 - Redis L2 cache regression - MPUT not working 2021-09-22 23:13:39 +12:00
Rob BygraveandGitHub 13c94ac78d Merge pull request #2386 from ebean-orm/feature/refactor-simplify-loggers
Refactor internals, reduce the number of loggers used and simplify
2021-09-22 22:33:49 +12:00
Rob Bygrave f467ca2e10 Refactor internals, reduce the number of loggers used and simplify 2021-09-22 22:29:41 +12:00
Rob BygraveandGitHub d5c24d327e Merge pull request #2384 from ebean-orm/feature/2039
#2039 Map LocalDateTime when generating DB migrations for Postgres to timestamp DB type
2021-09-22 16:53:17 +12:00
Rob Bygrave 23cd45b5d1 #2039 LocalDateTime ignore timestamp->localdatetime as a type change
Historically LocalDateTime mapped to logical timestamp and we need to treat that to be not a change in type. Migrations then will not generate a AlterColumn migration when we start using the new logical type localdatetime.
2021-09-22 16:51:47 +12:00
Rob Bygrave a14f7a1766 #2039 Map LocalDateTime when generating DB migrations for Postgres to timestamp DB type 2021-09-22 16:23:10 +12:00
Rob BygraveandGitHub c86a8c2d32 Merge pull request #2332 from ChenZhangg/Modify_MAVEN_1
Improve MAVEN build Performance
2021-09-22 14:15:13 +12:00
Rob Bygrave e85a471fcf #2380 Related test pom only changes
Note that we can't run both test-java16 and test-kotlin together as kotlin isn't yet working on JDK 16
2021-09-22 14:11:46 +12:00
Rob BygraveandGitHub 57689db291 Merge pull request #2380 from cit-consulting/isToManyDirty_cce
WIP: Try to fix ClassCastException in isToManyDirty() check
2021-09-22 14:00:19 +12:00
Rob Bygrave fec87b5281 Test against Postgres JDBC driver excluding the checker-qual dependency 2021-09-21 21:16:43 +12:00
Rob Bygrave 21bd83b417 Fix TestQueryJoinOnFormula with Postgres specific sql 2021-09-21 21:16:06 +12:00
Vladimir Konkov fde5350c43 Kotlin-based test 2021-09-21 11:49:36 +03:00
Rob Bygrave 769f6b72ae Bump to 12.12.0-SNAPSHOT 2021-09-21 15:04:08 +12:00
Rob Bygrave 97e9b3c473 #2383 - Refactor rename Pairs methods for consistency (that are expected to be used only internally) 2021-09-21 15:01:01 +12:00
Rob BygraveandGitHub 3550bf61c4 Refactor rename TransactionManager methods (#2382) 2021-09-21 14:54:26 +12:00
Rob BygraveandGitHub 0bf8c9eb64 Add module-info support via multi-version jar (#2381) 2021-09-21 14:37:51 +12:00
Vladimir Konkov 01e7ddcffd Try to fix ClassCastException in isToManyDirty() check 2021-09-20 20:02:58 +03:00
Rob Bygrave b450227b13 [maven-release-plugin] prepare for next development iteration 2021-09-20 12:41:40 +12:00
Chen Zhang a1b4b1d8ca Improve MAVEN build Performance 2021-08-27 09:24:13 +08:00
262 changed files with 2772 additions and 2577 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ env:
install: true
script:
- mvn clean test
- mvn -T 1C clean test
after_failure:
- ./.travis/print_surefire_reports
+1 -1
View File
@@ -36,7 +36,7 @@ Post questions or issues to the Ebean google group - https://groups.google.com/f
Goto [https://ebean.io/docs/](https://ebean.io/docs/)
## Maven cental links:
## Maven central links:
[Maven central - ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.ebean%22%20AND%20a%3A%22ebean%22 "maven central ebean")
[Maven central - all related projects](http://search.maven.org/#search%7Cga%7C1%7Cebean "maven central all related projects")
+11 -12
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.11.5</version>
<version>12.12.3</version>
</parent>
<name>ebean api</name>
@@ -27,7 +27,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-config</artifactId>
<version>1.4</version>
<version>1.5</version>
</dependency>
<!--
@@ -36,9 +36,8 @@
-->
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsr305</artifactId>
<version>1.1</version>
<scope>provided</scope>
<artifactId>avaje-lang</artifactId>
<version>1.0</version>
</dependency>
<dependency>
@@ -116,16 +115,16 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.24</version>
<extensions>true</extensions>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
<tiles>
<tile>io.avaje.tile:moditech-module:1.0</tile>
</tiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -1,5 +1,7 @@
package io.ebean;
import io.avaje.lang.NonNullApi;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
@@ -18,6 +20,7 @@ import java.util.concurrent.TimeUnit;
* This also propagates MDC context from the current thread to the
* background task if defined.
*/
@NonNullApi
public interface BackgroundExecutor {
/**
@@ -1,7 +1,7 @@
package io.ebean;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import java.util.List;
import java.util.Optional;
@@ -27,10 +27,10 @@ import java.util.Optional;
* @param <I> The ID type
* @param <T> The Bean type
*/
@NonNullApi
public abstract class BeanFinder<I,T> {
protected final Database server;
protected final Class<T> type;
/**
@@ -81,7 +81,6 @@ public abstract class BeanFinder<I,T> {
* <p>
* Equivalent to {@link Database#reference(Class, Object)}
*/
@Nonnull
public T ref(I id) {
return db().reference(type, id);
}
@@ -97,7 +96,6 @@ public abstract class BeanFinder<I,T> {
/**
* Find an entity by ID returning an Optional.
*/
@Nullable
public Optional<T> findByIdOrEmpty(I id) {
return db().find(type).setId(id).findOneOrEmpty();
}
@@ -112,7 +110,6 @@ public abstract class BeanFinder<I,T> {
/**
* Retrieves all entities of the given type.
*/
@Nonnull
public List<T> findAll() {
return query().findList();
}
@@ -1,5 +1,6 @@
package io.ebean;
import io.avaje.lang.NonNullApi;
import io.ebean.bean.EntityBean;
import java.util.Collection;
@@ -31,6 +32,7 @@ import java.util.Collection;
* @param <I> The ID type
* @param <T> The Bean type
*/
@NonNullApi
public abstract class BeanRepository<I, T> extends BeanFinder<I, T> {
/**
@@ -1,6 +1,5 @@
package io.ebean;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.Set;
@@ -138,7 +137,6 @@ public interface BeanState {
/**
* Returns a map with load errors.
*/
@Nullable
Map<String, Exception> loadErrors();
/**
+4 -81
View File
@@ -1,13 +1,13 @@
package io.ebean;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import io.ebean.annotation.TxIsolation;
import io.ebean.cache.ServerCacheManager;
import io.ebean.plugin.Property;
import io.ebean.text.csv.CsvReader;
import io.ebean.text.json.JsonContext;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import java.util.Collection;
@@ -60,6 +60,7 @@ import java.util.concurrent.Callable;
*
* }</pre>
*/
@NonNullApi
public final class DB {
private static final DbContext context = DbContext.getInstance();
@@ -523,15 +524,13 @@ public final class DB {
* @param bean The entity bean to check uniqueness on
* @return a set of Properties if constraint validation was detected or empty list.
*/
@Nonnull
public static Set<Property> checkUniqueness(Object bean) {
return getDefault().checkUniqueness(bean);
}
/**
* Same as {@link #checkUniqueness(Object)}. but with given transaction.
* Same as {@link #checkUniqueness(Object)} but with given transaction.
*/
@Nonnull
public static Set<Property> checkUniqueness(Object bean, Transaction transaction) {
return getDefault().checkUniqueness(bean, transaction);
}
@@ -851,7 +850,6 @@ public final class DB {
* }</pre>
*/
public static <T> Update<T> createUpdate(Class<T> beanType, String ormUpdate) {
return getDefault().createUpdate(beanType, ormUpdate);
}
@@ -859,7 +857,6 @@ public final class DB {
* Create a CsvReader for a given beanType.
*/
public static <T> CsvReader<T> createCsvReader(Class<T> beanType) {
return getDefault().createCsvReader(beanType);
}
@@ -897,7 +894,6 @@ public final class DB {
* @return A ORM Query for this beanType
*/
public static <T> Query<T> createQuery(Class<T> beanType) {
return getDefault().createQuery(beanType);
}
@@ -935,7 +931,6 @@ public final class DB {
* @return The query with expressions defined as per the parsed query statement
*/
public static <T> Query<T> createQuery(Class<T> beanType, String eql) {
return getDefault().createQuery(beanType, eql);
}
@@ -951,7 +946,6 @@ public final class DB {
* @return A ORM Query object for this beanType
*/
public static <T> Query<T> find(Class<T> beanType) {
return getDefault().find(beanType);
}
@@ -1030,77 +1024,6 @@ public final class DB {
return getDefault().filter(beanType);
}
// /**
// * Execute a Sql Update Delete or Insert statement. This returns the number of
// * rows that where updated, deleted or inserted. If is executed in batch then
// * this returns -1. You can get the actual rowCount after commit() from
// * updateSql.getRowCount().
// * <p>
// * If you wish to execute a Sql Select natively then you should use the
// * FindByNativeSql object.
// * </p>
// * <p>
// * Note that the table modification information is automatically deduced and
// * you do not need to call the DB.externalModification() method when you
// * use this method.
// * </p>
// * <p>
// * Example:
// * </p>
// * <pre>{@code
// *
// * // example that uses 'named' parameters
// * String s = "UPDATE f_topic set post_count = :count where id = :id"
// *
// * SqlUpdate update = DB.createSqlUpdate(s);
// *
// * update.setParameter("id", 1);
// * update.setParameter("count", 50);
// *
// * int modifiedCount = DB.execute(update);
// *
// * String msg = "There where " + modifiedCount + "rows updated";
// *
// * }</pre>
// *
// * @param sqlUpdate the update sql potentially with bind values
// * @return the number of rows updated or deleted. -1 if executed in batch.
// * @see SqlUpdate
// * @see CallableSql
// * @see DB#execute(CallableSql)
// */
// public static int execute(SqlUpdate sqlUpdate) {
// return defaultDatabase().execute(sqlUpdate);
// }
//
// /**
// * For making calls to stored procedures.
// * <p>
// * Example:
// * </p>
// * <pre>{@code
// *
// * String sql = "{call sp_order_modify(?,?,?)}";
// *
// * CallableSql cs = DB.createCallableSql(sql);
// * cs.setParameter(1, 27);
// * cs.setParameter(2, "SHIPPED");
// * cs.registerOut(3, Types.INTEGER);
// *
// * DB.execute(cs);
// *
// * // read the out parameter
// * Integer returnValue = (Integer) cs.getObject(3);
// *
// * }</pre>
// *
// * @see CallableSql
// * @see Ebean#execute(SqlUpdate)
// */
// public static int execute(CallableSql callableSql) {
// return defaultDatabase().execute(callableSql);
// }
/**
* Execute a TxRunnable in a Transaction with an explicit scope.
* <p>
+10 -7
View File
@@ -1,5 +1,7 @@
package io.ebean;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import io.ebean.annotation.Platform;
import io.ebean.annotation.TxIsolation;
import io.ebean.cache.ServerCacheManager;
@@ -10,8 +12,6 @@ import io.ebean.plugin.SpiServer;
import io.ebean.text.csv.CsvReader;
import io.ebean.text.json.JsonContext;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import javax.sql.DataSource;
@@ -92,6 +92,7 @@ import java.util.concurrent.Callable;
* @see DatabaseFactory
* @see DatabaseConfig
*/
@NonNullApi
public interface Database {
/**
@@ -575,8 +576,8 @@ public interface Database {
<T> DtoQuery<T> createNamedDtoQuery(Class<T> dtoType, String namedQuery);
/**
* Look to execute a native sql query that does not returns beans but instead
* returns SqlRow or direct access to ResultSet (see {@link SqlQuery#findList(RowMapper)}.
* Look to execute a native sql query that does not return beans but instead
* returns SqlRow or direct access to ResultSet.
*
* <p>
* Refer to {@link DtoQuery} for native sql queries returning DTO beans.
@@ -949,7 +950,6 @@ public interface Database {
* @param beanType the type of entity bean
* @param id the id value
*/
@Nonnull
<T> T reference(Class<T> beanType, Object id);
/**
@@ -1236,6 +1236,7 @@ public interface Database {
* @param id the bean id value
* @param transaction the transaction to use (can be null)
*/
@Nullable
<T> T find(Class<T> beanType, Object id, Transaction transaction);
/**
@@ -1294,13 +1295,11 @@ public interface Database {
* @param bean The entity bean to check uniqueness on
* @return a set of Properties if constraint validation was detected or empty list.
*/
@Nonnull
Set<Property> checkUniqueness(Object bean);
/**
* Same as {@link #checkUniqueness(Object)}. but with given transaction.
*/
@Nonnull
Set<Property> checkUniqueness(Object bean, Transaction transaction);
/**
@@ -1614,6 +1613,7 @@ public interface Database {
* @param id the id of the entity bean
* @param transaction the transaction the publish process should use (can be null)
*/
@Nullable
<T> T publish(Class<T> beanType, Object id, Transaction transaction);
/**
@@ -1627,6 +1627,7 @@ public interface Database {
* @param beanType the type of the entity bean
* @param id the id of the entity bean
*/
@Nullable
<T> T publish(Class<T> beanType, Object id);
/**
@@ -1665,6 +1666,7 @@ public interface Database {
* @param id the id of the entity bean to restore
* @param transaction the transaction the restore process should use (can be null)
*/
@Nullable
<T> T draftRestore(Class<T> beanType, Object id, Transaction transaction);
/**
@@ -1678,6 +1680,7 @@ public interface Database {
* @param beanType the type of the entity bean
* @param id the id of the entity bean to restore
*/
@Nullable
<T> T draftRestore(Class<T> beanType, Object id);
/**
@@ -15,8 +15,7 @@ import java.util.concurrent.locks.ReentrantLock;
*/
final class DbContext {
private static final Logger logger = LoggerFactory.getLogger(DbContext.class);
private static final Logger log = LoggerFactory.getLogger("io.ebean");
static {
EbeanVersion.getVersion();
}
@@ -39,7 +38,6 @@ final class DbContext {
if (!DbPrimary.isSkip()) {
// look to see if there is a default server defined
String defaultName = DbPrimary.getDefaultServerName();
logger.debug("defaultName:{}", defaultName);
if (defaultName != null && !defaultName.trim().isEmpty()) {
defaultDatabase = getWithCreate(defaultName.trim());
}
@@ -54,7 +52,7 @@ final class DbContext {
throw new DataSourceConfigurationException(msg, e);
} catch (Throwable e) {
logger.error("Error trying to create the default Database", e);
log.error("Error trying to create the default Database", e);
throw new RuntimeException(e);
}
}
@@ -1,9 +1,10 @@
package io.ebean;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import io.ebean.docstore.DocQueryContext;
import io.ebean.docstore.RawDoc;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -13,6 +14,7 @@ import java.util.function.Predicate;
/**
* Document storage operations.
*/
@NonNullApi
public interface DocumentStore {
/**
@@ -1,7 +1,7 @@
package io.ebean;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
@@ -38,12 +38,12 @@ import java.util.stream.Stream;
*
* }</pre>
*/
@NonNullApi
public interface DtoQuery<T> extends CancelableQuery {
/**
* Execute the query returning a list.
*/
@Nonnull
List<T> findList();
/**
@@ -53,7 +53,6 @@ public interface DtoQuery<T> extends CancelableQuery {
* resultSet and potentially connection and MUST be closed. We should use
* QueryIterator in a <em>try with resource block</em>.
*/
@Nonnull
QueryIterator<T> findIterate();
/**
@@ -63,7 +62,6 @@ public interface DtoQuery<T> extends CancelableQuery {
* resultSet and potentially connection and MUST be closed. We should use
* the Stream in a <em>try with resource block</em>.
*/
@Nonnull
Stream<T> findStream();
/**
@@ -105,7 +103,6 @@ public interface DtoQuery<T> extends CancelableQuery {
/**
* Execute the query returning an optional bean.
*/
@Nonnull
Optional<T> findOneOrEmpty();
/**
+1 -4
View File
@@ -1,13 +1,12 @@
package io.ebean;
import io.avaje.lang.Nullable;
import io.ebean.annotation.TxIsolation;
import io.ebean.cache.ServerCacheManager;
import io.ebean.plugin.Property;
import io.ebean.text.csv.CsvReader;
import io.ebean.text.json.JsonContext;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import java.util.Collection;
@@ -506,7 +505,6 @@ public final class Ebean {
* @param bean The entity bean to check uniqueness on
* @return a set of Properties if constraint validation was detected or empty list.
*/
@Nonnull
public static Set<Property> checkUniqueness(Object bean) {
return getDefault().checkUniqueness(bean);
}
@@ -514,7 +512,6 @@ public final class Ebean {
/**
* Same as {@link #checkUniqueness(Object)}. but with given transaction.
*/
@Nonnull
public static Set<Property> checkUniqueness(Object bean, Transaction transaction) {
return getDefault().checkUniqueness(bean, transaction);
}
@@ -14,26 +14,75 @@ import java.util.Properties;
*/
public class EbeanVersion {
private static final Logger logger = LoggerFactory.getLogger(EbeanVersion.class);
private static final Logger log = LoggerFactory.getLogger("io.ebean");
/**
* Maintain the minimum ebean-agent version manually based on required ebean-agent bug fixes.
*/
private static final int MIN_AGENT_MAJOR_VERSION = 12;
private static final int MIN_AGENT_MINOR_VERSION = 12;
private static String version = "unknown";
static {
readVersion();
checkAgentVersion();
}
private static void readVersion() {
try {
Properties prop = new Properties();
try (InputStream in = DB.class.getResourceAsStream("/META-INF/maven/io.ebean/ebean/pom.properties")) {
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-api/pom.properties")) {
if (in != null) {
prop.load(in);
in.close();
version = prop.getProperty("version");
version = readVersion(in);
}
}
logger.info("ebean version: {}", version);
log.info("ebean version: {}", version);
} catch (IOException e) {
logger.warn("Could not determine ebean version: {}", e.getMessage());
log.warn("Could not determine ebean version: {}", e.getMessage());
}
}
private static void checkAgentVersion() {
try {
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-agent/pom.properties")) {
// often we only have ebean-agent during development (with build time enhancement), null is expected
if (in != null) {
String agentVersion = readVersion(in);
if (agentVersion != null) {
if (checkMinAgentVersion(agentVersion)) {
log.error("Expected minimum ebean-agent version {}.{}.0 but we have {}, please update the ebean-agent", MIN_AGENT_MAJOR_VERSION, MIN_AGENT_MINOR_VERSION, agentVersion);
}
}
}
}
} catch (IOException e) {
log.warn("Could not check minimum ebean-agent version {}.{}.0 required due to - {}", MIN_AGENT_MAJOR_VERSION, MIN_AGENT_MINOR_VERSION, e.getMessage());
}
}
/**
* Return true if ebean-agent is NOT at our minimum version.
*/
static boolean checkMinAgentVersion(String agentVersion) {
String[] versionSegments = agentVersion.split("\\.");
if (versionSegments.length != 3) {
return true;
} else {
int major = Integer.parseInt(versionSegments[0]);
int minor = Integer.parseInt(versionSegments[1]);
if (major < MIN_AGENT_MAJOR_VERSION) {
return true;
} else {
return major == MIN_AGENT_MAJOR_VERSION && minor < MIN_AGENT_MINOR_VERSION;
}
}
}
private static String readVersion(InputStream in) throws IOException {
Properties prop = new Properties();
prop.load(in);
in.close();
return prop.getProperty("version");
}
private EbeanVersion() {
// hide
}
@@ -1,6 +1,5 @@
package io.ebean;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Future;
@@ -25,13 +24,11 @@ public class EmptyPagedList<T> implements PagedList<T> {
// do nothing
}
@Nonnull
@Override
public Future<Integer> getFutureCount() {
return null;
}
@Nonnull
@Override
public List<T> getList() {
return Collections.emptyList();
@@ -1,21 +1,13 @@
package io.ebean;
import io.ebean.search.Match;
import io.ebean.search.MultiMatch;
import io.ebean.search.TextCommonTerms;
import io.ebean.search.TextQueryString;
import io.ebean.search.TextSimple;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import io.ebean.search.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.NonUniqueResultException;
import java.sql.Connection;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -39,6 +31,7 @@ import java.util.function.Predicate;
*
* @see Query#where()
*/
@NonNullApi
public interface ExpressionList<T> {
/**
@@ -327,7 +320,6 @@ public interface ExpressionList<T> {
*
* @see Query#findList()
*/
@Nonnull
List<T> findList();
/**
@@ -335,7 +327,6 @@ public interface ExpressionList<T> {
*
* @see Query#findIds()
*/
@Nonnull
<A> List<A> findIds();
/**
@@ -351,7 +342,6 @@ public interface ExpressionList<T> {
*
* @see Query#findSet()
*/
@Nonnull
Set<T> findSet();
/**
@@ -359,7 +349,6 @@ public interface ExpressionList<T> {
*
* @see Query#findMap()
*/
@Nonnull
<K> Map<K, T> findMap();
/**
@@ -392,7 +381,6 @@ public interface ExpressionList<T> {
*
* @return the list of values for the selected property
*/
@Nonnull
<A> List<A> findSingleAttributeList();
/**
@@ -429,7 +417,6 @@ public interface ExpressionList<T> {
/**
* Execute the query returning an optional bean.
*/
@Nonnull
Optional<T> findOneOrEmpty();
/**
@@ -442,7 +429,6 @@ public interface ExpressionList<T> {
*
* @return a Future object for the row count query
*/
@Nonnull
FutureRowCount<T> findFutureCount();
/**
@@ -455,7 +441,6 @@ public interface ExpressionList<T> {
*
* @return a Future object for the list of Id's
*/
@Nonnull
FutureIds<T> findFutureIds();
/**
@@ -468,7 +453,6 @@ public interface ExpressionList<T> {
*
* @return a Future object for the list result of the query
*/
@Nonnull
FutureList<T> findFutureList();
/**
@@ -499,7 +483,6 @@ public interface ExpressionList<T> {
* @return The PagedList
* @see Query#findPagedList()
*/
@Nonnull
PagedList<T> findPagedList();
/**
@@ -509,7 +492,6 @@ public interface ExpressionList<T> {
* It will execute the query against the history returning the versions of the bean.
* </p>
*/
@Nonnull
List<Version<T>> findVersions();
/**
@@ -519,13 +501,11 @@ public interface ExpressionList<T> {
* It will execute the query against the history returning the versions of the bean.
* </p>
*/
@Nonnull
List<Version<T>> findVersionsBetween(Timestamp start, Timestamp end);
/**
* Add some filter predicate expressions to the many property.
*/
@Nonnull
ExpressionList<T> filterMany(String manyProperty);
/**
@@ -1,7 +1,7 @@
package io.ebean;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.avaje.lang.Nullable;
import javax.persistence.NonUniqueResultException;
import java.time.Clock;
import java.util.List;
@@ -82,7 +82,6 @@ public interface ExtendedServer {
*
* @see Query#findIds()
*/
@Nonnull
<A, T> List<A> findIds(Query<T> query, Transaction transaction);
/**
@@ -100,7 +99,6 @@ public interface ExtendedServer {
* @see Query#findEach(Consumer)
* @see Query#findEachWhile(Predicate)
*/
@Nonnull
<T> QueryIterator<T> findIterate(Query<T> query, Transaction transaction);
/**
@@ -112,7 +110,6 @@ public interface ExtendedServer {
* Note that the stream needs to be closed so use with try with resources.
* </p>
*/
@Nonnull
<T> Stream<T> findStream(Query<T> query, Transaction transaction);
/**
@@ -125,7 +122,6 @@ public interface ExtendedServer {
* <p>
* Note that the stream needs to be closed so use with try with resources.
*/
@Nonnull
@Deprecated
<T> Stream<T> findLargeStream(Query<T> query, Transaction transaction);
@@ -210,7 +206,6 @@ public interface ExtendedServer {
* It will execute the query against the history returning the versions of the bean.
* </p>
*/
@Nonnull
<T> List<Version<T>> findVersions(Query<T> query, Transaction transaction);
/**
@@ -235,7 +230,6 @@ public interface ExtendedServer {
* @return the list of fetched beans.
* @see Query#findList()
*/
@Nonnull
<T> List<T> findList(Query<T> query, Transaction transaction);
/**
@@ -251,7 +245,6 @@ public interface ExtendedServer {
* @return a Future object for the row count query
* @see Query#findFutureCount()
*/
@Nonnull
<T> FutureRowCount<T> findFutureCount(Query<T> query, Transaction transaction);
/**
@@ -267,7 +260,6 @@ public interface ExtendedServer {
* @return a Future object for the list of Id's
* @see Query#findFutureIds()
*/
@Nonnull
<T> FutureIds<T> findFutureIds(Query<T> query, Transaction transaction);
/**
@@ -284,7 +276,6 @@ public interface ExtendedServer {
* @return a Future object for the list result of the query
* @see Query#findFutureList()
*/
@Nonnull
<T> FutureList<T> findFutureList(Query<T> query, Transaction transaction);
/**
@@ -316,7 +307,6 @@ public interface ExtendedServer {
* @return The PagedList
* @see Query#findPagedList()
*/
@Nonnull
<T> PagedList<T> findPagedList(Query<T> query, Transaction transaction);
/**
@@ -341,7 +331,6 @@ public interface ExtendedServer {
* @return the set of fetched beans.
* @see Query#findSet()
*/
@Nonnull
<T> Set<T> findSet(Query<T> query, Transaction transaction);
/**
@@ -358,7 +347,6 @@ public interface ExtendedServer {
* @return the map of fetched beans.
* @see Query#findMap()
*/
@Nonnull
<K, T> Map<K, T> findMap(Query<T> query, Transaction transaction);
/**
@@ -391,7 +379,6 @@ public interface ExtendedServer {
* @return the list of values for the selected property
* @see Query#findSingleAttributeList()
*/
@Nonnull
<A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction);
/**
@@ -419,7 +406,6 @@ public interface ExtendedServer {
/**
* Similar to findOne() but returns an Optional (rather than nullable).
*/
@Nonnull
<T> Optional<T> findOneOrEmpty(Query<T> query, Transaction transaction);
/**
@@ -463,7 +449,6 @@ public interface ExtendedServer {
* @return the list of fetched MapBean.
* @see SqlQuery#findList()
*/
@Nonnull
List<SqlRow> findList(SqlQuery query, Transaction transaction);
/**
@@ -1,9 +1,8 @@
package io.ebean;
import io.avaje.lang.NonNullApi;
import io.ebean.service.SpiFetchGroupQuery;
import javax.annotation.Nonnull;
/**
* Defines what part of the object graph to load (select and fetch clauses).
* <p>
@@ -62,6 +61,7 @@ import javax.annotation.Nonnull;
*
* @param <T> The bean type the Fetch group can be applied to
*/
@NonNullApi
public interface FetchGroup<T> {
/**
@@ -83,7 +83,6 @@ public interface FetchGroup<T> {
*
* @return The FetchGroup with the given select clause
*/
@Nonnull
static <T> FetchGroup<T> of(Class<T> cls, String select) {
return XServiceProvider.fetchGroupOf(cls, select);
}
@@ -108,7 +107,6 @@ public interface FetchGroup<T> {
*
* @return The FetchGroupBuilder with the given select clause which we will add fetch clauses to
*/
@Nonnull
static <T> FetchGroupBuilder<T> of(Class<T> cls) {
return XServiceProvider.fetchGroupOf(cls);
}
@@ -1,6 +1,6 @@
package io.ebean;
import javax.annotation.Nonnull;
import io.avaje.lang.NonNullApi;
/**
* Builds a FetchGroup by adding fetch clauses.
@@ -23,85 +23,73 @@ import javax.annotation.Nonnull;
*
* }</pre>
*/
@NonNullApi
public interface FetchGroupBuilder<T> {
/**
* Specify specific properties to select (top level properties).
*/
@Nonnull
FetchGroupBuilder<T> select(String select);
/**
* Fetch all the properties at the given path.
*/
@Nonnull
FetchGroupBuilder<T> fetch(String path);
/**
* Fetch the path with the nested fetch group.
*/
@Nonnull
FetchGroupBuilder<T> fetch(String path, FetchGroup<?> nestedGroup);
/**
* Fetch the path using a query join with the nested fetch group.
*/
@Nonnull
FetchGroupBuilder<T> fetchQuery(String path, FetchGroup<?> nestedGroup);
/**
* Fetch the path lazily with the nested fetch group.
*/
@Nonnull
FetchGroupBuilder<T> fetchLazy(String path, FetchGroup<?> nestedGroup);
/**
* Fetch the path including specified properties.
*/
@Nonnull
FetchGroupBuilder<T> fetch(String path, String properties);
/**
* Fetch the path including all its properties using a query join.
*/
@Nonnull
FetchGroupBuilder<T> fetchQuery(String path);
/**
* Fetch the path including all its properties using L2 cache.
* Cache misses fallback to fetchQuery().
*/
@Nonnull
FetchGroupBuilder<T> fetchCache(String path);
/**
* Fetch the path including specified properties using a query join.
*/
@Nonnull
FetchGroupBuilder<T> fetchQuery(String path, String properties);
/**
* Fetch the path including specified properties using L2 cache.
* Cache misses fallback to fetchQuery().
*/
@Nonnull
FetchGroupBuilder<T> fetchCache(String path, String properties);
/**
* Fetch the path including all its properties lazily.
*/
@Nonnull
FetchGroupBuilder<T> fetchLazy(String path);
/**
* Fetch the path including specified properties lazily.
*/
@Nonnull
FetchGroupBuilder<T> fetchLazy(String path, String properties);
/**
* Build and return the FetchGroup.
*/
@Nonnull
FetchGroup<T> build();
}
@@ -1,5 +1,7 @@
package io.ebean;
import io.avaje.lang.NonNullApi;
import java.util.List;
import java.util.Set;
@@ -77,6 +79,7 @@ import java.util.Set;
*
* @param <T> the entity bean type
*/
@NonNullApi
public interface Filter<T> {
/**
+3 -4
View File
@@ -1,7 +1,7 @@
package io.ebean;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import java.util.List;
/**
@@ -55,6 +55,7 @@ import java.util.List;
* }</pre>
*
*/
@NonNullApi
public class Finder<I, T> {
/**
@@ -139,7 +140,6 @@ public class Finder<I, T> {
* <p>
* Equivalent to {@link Database#reference(Class, Object)}
*/
@Nonnull
public T ref(I id) {
return db().reference(type, id);
}
@@ -166,7 +166,6 @@ public class Finder<I, T> {
/**
* Retrieves all entities of the given type.
*/
@Nonnull
public List<T> all() {
return query().findList();
}
@@ -113,9 +113,9 @@ public interface Junction<T> extends Expression, ExpressionList<T> {
*/
SHOULD("should", "", true);
private String prefix;
private String literal;
private boolean text;
private final String prefix;
private final String literal;
private final boolean text;
Type(String literal, String prefix, boolean text) {
this.literal = literal;
@@ -1,6 +1,5 @@
package io.ebean;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.concurrent.Future;
@@ -116,13 +115,11 @@ public interface PagedList<T> {
*
* }</pre>
*/
@Nonnull
Future<Integer> getFutureCount();
/**
* Return the list of entities for this page.
*/
@Nonnull
List<T> getList();
/**
+5 -5
View File
@@ -111,28 +111,28 @@ public final class Pairs {
/**
* Return the first property name.
*/
public String getProperty0() {
public String property0() {
return property0;
}
/**
* Return the second property name.
*/
public String getProperty1() {
public String property1() {
return property1;
}
/**
* Return all the value pairs.
*/
public List<Entry> getEntries() {
public List<Entry> entries() {
return Collections.unmodifiableList(entries);
}
/**
* Return the separator character used with DB varchar concatenation to combine the 2 values.
*/
public String getConcatSeparator() {
public String concatSeparator() {
return concatSeparator;
}
@@ -155,7 +155,7 @@ public final class Pairs {
/**
* Return a suffix used with DB varchar concatenation to combine the 2 values.
*/
public String getConcatSuffix() {
public String concatSuffix() {
return concatSuffix;
}
+3 -17
View File
@@ -1,7 +1,7 @@
package io.ebean;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import javax.persistence.NonUniqueResultException;
import java.sql.Connection;
import java.sql.Timestamp;
@@ -177,6 +177,7 @@ import java.util.stream.Stream;
*
* @param <T> the type of Entity bean this query will fetch.
*/
@NonNullApi
public interface Query<T> extends CancelableQuery {
/**
@@ -689,7 +690,6 @@ public interface Query<T> extends CancelableQuery {
* This query will execute against the Database that was used to create it.
* </p>
*/
@Nonnull
<A> List<A> findIds();
/**
@@ -727,7 +727,6 @@ public interface Query<T> extends CancelableQuery {
*
* }</pre>
*/
@Nonnull
QueryIterator<T> findIterate();
/**
@@ -749,7 +748,6 @@ public interface Query<T> extends CancelableQuery {
*
* }</pre>
*/
@Nonnull
Stream<T> findStream();
/**
@@ -772,7 +770,6 @@ public interface Query<T> extends CancelableQuery {
*
* }</pre>
*/
@Nonnull
@Deprecated
Stream<T> findLargeStream();
@@ -882,7 +879,6 @@ public interface Query<T> extends CancelableQuery {
*
* }</pre>
*/
@Nonnull
List<T> findList();
/**
@@ -898,7 +894,6 @@ public interface Query<T> extends CancelableQuery {
*
* }</pre>
*/
@Nonnull
Set<T> findSet();
/**
@@ -918,7 +913,6 @@ public interface Query<T> extends CancelableQuery {
*
* }</pre>
*/
@Nonnull
<K> Map<K, T> findMap();
/**
@@ -951,7 +945,6 @@ public interface Query<T> extends CancelableQuery {
*
* @return the list of values for the selected property
*/
@Nonnull
<A> List<A> findSingleAttributeList();
/**
@@ -1049,7 +1042,6 @@ public interface Query<T> extends CancelableQuery {
/**
* Execute the query returning an optional bean.
*/
@Nonnull
Optional<T> findOneOrEmpty();
/**
@@ -1064,7 +1056,6 @@ public interface Query<T> extends CancelableQuery {
* It will execute the query against the history returning the versions of the bean.
* </p>
*/
@Nonnull
List<Version<T>> findVersions();
/**
@@ -1074,7 +1065,6 @@ public interface Query<T> extends CancelableQuery {
* It will execute the query against the history returning the versions of the bean.
* </p>
*/
@Nonnull
List<Version<T>> findVersionsBetween(Timestamp start, Timestamp end);
/**
@@ -1132,7 +1122,6 @@ public interface Query<T> extends CancelableQuery {
*
* @return a Future object for the row count query
*/
@Nonnull
FutureRowCount<T> findFutureCount();
/**
@@ -1145,7 +1134,6 @@ public interface Query<T> extends CancelableQuery {
*
* @return a Future object for the list of Id's
*/
@Nonnull
FutureIds<T> findFutureIds();
/**
@@ -1157,7 +1145,6 @@ public interface Query<T> extends CancelableQuery {
*
* @return a Future object for the list result of the query
*/
@Nonnull
FutureList<T> findFutureList();
/**
@@ -1187,7 +1174,6 @@ public interface Query<T> extends CancelableQuery {
*
* @return The PagedList
*/
@Nonnull
PagedList<T> findPagedList();
/**
@@ -1,7 +1,7 @@
package io.ebean;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@@ -37,12 +37,12 @@ import java.util.function.Predicate;
*
* }</pre>
*/
@NonNullApi
public interface SqlQuery extends Serializable, CancelableQuery {
/**
* Execute the query returning a list.
*/
@Nonnull
List<SqlRow> findList();
/**
@@ -119,7 +119,6 @@ public interface SqlQuery extends Serializable, CancelableQuery {
/**
* Execute the query returning an optional row.
*/
@Nonnull
Optional<SqlRow> findOneOrEmpty();
/**
@@ -354,6 +353,7 @@ public interface SqlQuery extends Serializable, CancelableQuery {
/**
* Return the single value.
*/
@Nullable
T findOne();
/**
@@ -9,11 +9,7 @@ import javax.persistence.PersistenceException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.net.URL;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -1164,7 +1160,7 @@ public final class EntityBeanIntercept implements Serializable {
*/
public Map<String, Exception> getLoadErrors() {
if (loadErrors == null) {
return null;
return Collections.emptyMap();
}
Map<String, Exception> ret = null;
int len = getPropertyLength();
@@ -60,21 +60,15 @@ public interface PersistenceContext {
int size(Class<?> rootType);
/**
* Return a copy of the Persistence context to use for large query iteration.
* Signalizes the PersistenceContext, the begin for large query iteration.
*/
PersistenceContext forIterate();
void beginIterate();
/**
* Return a new Persistence context during iteration of large query result.
* Signalizes the PersistenceContext, the end for large query iteration.
*/
PersistenceContext forIterateReset();
/**
* Return true if the persistence context has grown and hit the 'reset limit'
* during large query iteration.
*/
boolean resetLimit();
void endIterate();
/**
* Wrapper on a bean to also indicate if a bean has been deleted.
* <p>
@@ -1,10 +1,5 @@
package io.ebean.config;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
/**
* Helper to find classes taking into account the context class loader.
*/
@@ -77,22 +72,14 @@ public class ClassLoadConfig {
* Return a new instance of the class using the default constructor.
*/
public Object newInstance(String className) {
try {
Class<?> cls = forName(className);
return cls.newInstance();
return cls.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new IllegalArgumentException("Error constructing " + className, e);
}
}
/**
* Return the resources for the given name.
*/
public Enumeration<URL> getResources(String name) throws IOException {
return context.getResources(name);
}
/**
* Return true if the given class is present.
*/
@@ -129,9 +116,7 @@ public class ClassLoadConfig {
* Optional - if set only use this classLoader (no fallback).
*/
protected final ClassLoader preferredLoader;
protected final ClassLoader contextLoader;
protected final ClassLoader callerLoader;
ClassLoaderContext(ClassLoader preferredLoader) {
@@ -145,15 +130,7 @@ public class ClassLoadConfig {
return (loader != null) ? loader : callerLoader;
}
Enumeration<URL> getResources(String name) throws IOException {
if (preferredLoader != null) {
return preferredLoader.getResources(name);
}
return contextLoader().getResources(name);
}
Class<?> forName(String name) throws ClassNotFoundException {
if (preferredLoader != null) {
// only use the explicitly set classLoader
return classForName(name, preferredLoader);
@@ -2,11 +2,7 @@ package io.ebean.config;
import com.fasterxml.jackson.core.JsonFactory;
import io.avaje.config.Config;
import io.ebean.DatabaseFactory;
import io.ebean.EbeanVersion;
import io.ebean.PersistenceContextScope;
import io.ebean.Query;
import io.ebean.Transaction;
import io.ebean.*;
import io.ebean.annotation.*;
import io.ebean.cache.ServerCachePlugin;
import io.ebean.config.dbplatform.DatabasePlatform;
@@ -14,14 +10,7 @@ import io.ebean.config.dbplatform.DbEncrypt;
import io.ebean.config.dbplatform.DbType;
import io.ebean.config.dbplatform.IdType;
import io.ebean.datasource.DataSourceConfig;
import io.ebean.event.BeanFindController;
import io.ebean.event.BeanPersistController;
import io.ebean.event.BeanPersistListener;
import io.ebean.event.BeanPostConstructListener;
import io.ebean.event.BeanPostLoad;
import io.ebean.event.BeanQueryAdapter;
import io.ebean.event.BulkTableEventListener;
import io.ebean.event.ServerConfigStartup;
import io.ebean.event.*;
import io.ebean.event.changelog.ChangeLogListener;
import io.ebean.event.changelog.ChangeLogPrepare;
import io.ebean.event.changelog.ChangeLogRegister;
@@ -34,14 +23,7 @@ import javax.sql.DataSource;
import java.time.Clock;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.*;
/**
* The configuration used for creating a Database.
@@ -82,7 +64,6 @@ import java.util.ServiceLoader;
*/
public class DatabaseConfig {
/**
* The Database name.
*/
@@ -402,8 +383,8 @@ public class DatabaseConfig {
private List<BeanPostConstructListener> postConstructListeners = new ArrayList<>();
private List<BeanPersistListener> persistListeners = new ArrayList<>();
private List<BeanQueryAdapter> queryAdapters = new ArrayList<>();
private List<BulkTableEventListener> bulkTableEventListeners = new ArrayList<>();
private List<ServerConfigStartup> configStartupListeners = new ArrayList<>();
private final List<BulkTableEventListener> bulkTableEventListeners = new ArrayList<>();
private final List<ServerConfigStartup> configStartupListeners = new ArrayList<>();
/**
* By default inserts are included in the change log.
@@ -411,42 +392,26 @@ public class DatabaseConfig {
private boolean changeLogIncludeInserts = true;
private ChangeLogPrepare changeLogPrepare;
private ChangeLogListener changeLogListener;
private ChangeLogRegister changeLogRegister;
private boolean changeLogAsync = true;
private ReadAuditLogger readAuditLogger;
private ReadAuditPrepare readAuditPrepare;
private EncryptKeyManager encryptKeyManager;
private EncryptDeployManager encryptDeployManager;
private Encryptor encryptor;
private boolean dbOffline;
private DbEncrypt dbEncrypt;
private boolean dbOffline;
private ServerCachePlugin serverCachePlugin;
/**
* The default PersistenceContextScope used if one is not explicitly set on a query.
*/
private PersistenceContextScope persistenceContextScope = PersistenceContextScope.TRANSACTION;
private JsonFactory jsonFactory;
private boolean localTimeWithNanos;
private boolean durationWithNanos;
private int maxCallStack = 5;
private boolean transactionRollbackOnChecked = true;
// configuration for the background executor service (thread pool)
@@ -1582,6 +1547,9 @@ public class DatabaseConfig {
/**
* Set to true if all DB column and table names should use quoted identifiers.
* <p>
* For Postgres pgjdbc version 42.3.0 should be used with datasource property
* <em>quoteReturningIdentifiers</em> set to <em>false</em> (refer #2303).
*/
public void setAllQuotedIdentifiers(boolean allQuotedIdentifiers) {
platformConfig.setAllQuotedIdentifiers(allQuotedIdentifiers);
@@ -2741,21 +2709,7 @@ public class DatabaseConfig {
this.classLoadConfig = classLoadConfig;
}
/**
* Return the service loader using the classLoader defined in ClassLoadConfig.
*/
public <T> ServiceLoader<T> serviceLoad(Class<T> spiService) {
return ServiceLoader.load(spiService, classLoadConfig.getClassLoader());
}
/**
* Return the first service using the service loader (or null).
*/
public <T> T service(Class<T> spiService) {
ServiceLoader<T> load = serviceLoad(spiService);
Iterator<T> serviceInstances = load.iterator();
return serviceInstances.hasNext() ? serviceInstances.next() : null;
}
/**
* Load settings from application.properties, application.yaml and other sources.
@@ -2794,7 +2748,7 @@ public class DatabaseConfig {
*/
private List<AutoConfigure> autoConfiguration() {
List<AutoConfigure> list = new ArrayList<>();
for (AutoConfigure autoConfigure : serviceLoad(AutoConfigure.class)) {
for (AutoConfigure autoConfigure : ServiceLoader.load(AutoConfigure.class)) {
autoConfigure.preConfigure(this);
list.add(autoConfigure);
}
@@ -117,6 +117,9 @@ public class PlatformConfig {
/**
* Set to true if all DB column and table names should use quoted identifiers.
* <p>
* For Postgres pgjdbc version 42.3.0 should be used with datasource property
* <em>quoteReturningIdentifiers</em> set to <em>false</em> (refer #2303).
*/
public void setAllQuotedIdentifiers(boolean allQuotedIdentifiers) {
this.allQuotedIdentifiers = allQuotedIdentifiers;
@@ -25,7 +25,7 @@ import java.sql.Types;
*/
public class DatabasePlatform {
private static final Logger logger = LoggerFactory.getLogger(DatabasePlatform.class);
private static final Logger log = LoggerFactory.getLogger("io.ebean");
/**
* Behavior used when ending a query only transaction (at read committed isolation level).
@@ -640,7 +640,7 @@ public class DatabasePlatform {
if (dbName.charAt(dbName.length() - 1) == BACK_TICK) {
return openQuote + dbName.substring(1, dbName.length() - 1) + closeQuote;
} else {
logger.error("Missing backquote on [" + dbName + "]");
log.error("Missing backquote on [" + dbName + "]");
}
} else if (allQuotedIdentifiers) {
return openQuote + dbName + closeQuote;
@@ -694,7 +694,7 @@ public class DatabasePlatform {
protected String withForUpdate(String sql, Query.LockWait lockWait, Query.LockType lockType) {
// silently assume the database does not support the "for update" clause.
logger.info("it seems your database does not support the 'for update' clause");
log.info("it seems your database does not support the 'for update' clause");
return sql;
}
@@ -728,7 +728,7 @@ public class DatabasePlatform {
if (!schemaExists(dbSchema, connection)) {
Statement query = connection.createStatement();
try {
logger.info("create schema:{}", dbSchema);
log.debug("create schema:{}", dbSchema);
query.executeUpdate("create schema " + dbSchema);
} finally {
JdbcClose.close(query);
@@ -758,7 +758,6 @@ public class DatabasePlatform {
* Return true if the table exists.
*/
public boolean tableExists(Connection connection, String catalog, String schema, String table) throws SQLException {
DatabaseMetaData metaData = connection.getMetaData();
ResultSet tables = metaData.getTables(catalog, schema, table, null);
try {
@@ -70,7 +70,6 @@ public class DbPlatformTypeMapping {
* Load the standard types. These can be overridden by DB specific platform.
*/
private void loadDefaults(boolean logicalTypes) {
put(DbType.BOOLEAN, BOOLEAN_LOGICAL);
put(DbType.BIT);
put(DbType.INTEGER);
@@ -88,7 +87,6 @@ public class DbPlatformTypeMapping {
put(DbType.LONGVARCHAR);
// most commonly real maps to db float
put(DbType.REAL, new DbPlatformType("float"));
put(DbType.POINT, POINT);
put(DbType.POLYGON, POLYGON);
put(DbType.LINESTRING, LINESTRING);
@@ -103,7 +101,7 @@ public class DbPlatformTypeMapping {
put(DbType.VARBINARY, new DbPlatformType("varbinary"));
put(DbType.BINARY, new DbPlatformType("binary"));
put(DbType.CHAR, new DbPlatformType("char"));
put(DbType.LOCALDATETIME, new DbPlatformType("localdatetime", false));
put(DbType.HSTORE, new DbPlatformType("hstore", false));
put(DbType.JSON, new DbPlatformType("json", false));
put(DbType.JSONB, new DbPlatformType("jsonb", false));
@@ -120,7 +118,7 @@ public class DbPlatformTypeMapping {
put(DbType.VARBINARY, new DbPlatformType("varbinary", 255));
put(DbType.BINARY, new DbPlatformType("binary", 255));
put(DbType.CHAR, new DbPlatformType("char", 1));
put(DbType.LOCALDATETIME, DbType.TIMESTAMP.createPlatformType());
put(DbType.JSON, JSON_CLOB_PLACEHOLDER); // Postgres maps this to JSON
put(DbType.JSONB, JSON_CLOB_PLACEHOLDER); // Postgres maps this to JSONB
put(DbType.JSONCLOB, JSON_CLOB_PLACEHOLDER);
@@ -137,7 +135,6 @@ public class DbPlatformTypeMapping {
* Lookup the platform specific DbType given the standard sql type name.
*/
public DbPlatformType lookup(String name, boolean withScale) {
DbType type = lookup.byName(name);
if (type == null) {
throw new IllegalArgumentException("Unknown type [" + name + "] - not standard sql type");
@@ -160,7 +157,6 @@ public class DbPlatformTypeMapping {
}
private DbPlatformType getJsonType(DbType type, boolean withScale) {
DbPlatformType dbType = get(type);
if (dbType == JSON_CLOB_PLACEHOLDER) {
// if we have scale that implies this maps to varchar
@@ -34,6 +34,7 @@ public enum DbType {
ARRAY(Types.ARRAY),
LOCALDATETIME(ExtraDbTypes.LOCALDATETIME),
UUID(ExtraDbTypes.UUID),
INET(ExtraDbTypes.INET),
CIDR(ExtraDbTypes.CIDR),
@@ -5,11 +5,6 @@ package io.ebean.config.dbplatform;
*/
public interface ExtraDbTypes {
/**
* DB native UUID type (H2 and Postgres).
*/
int UUID = 5010;
/**
* Type to map Map content to Postgres HSTORE.
*/
@@ -40,6 +35,12 @@ public interface ExtraDbTypes {
*/
int JSONBlob = 5005;
int LOCALDATETIME = 5009;
/**
* DB native UUID type (H2 and Postgres).
*/
int UUID = 5010;
int INET = 5020;
int CIDR = 5021;
@@ -24,23 +24,14 @@ import java.util.concurrent.locks.ReentrantLock;
*/
public abstract class SequenceIdGenerator implements PlatformIdGenerator {
protected static final Logger logger = LoggerFactory.getLogger("io.ebean.SEQ");
protected static final Logger log = LoggerFactory.getLogger("io.ebean.SEQ");
private final ReentrantLock lock = new ReentrantLock();
/**
* The actual sequence name.
*/
protected final String seqName;
protected final DataSource dataSource;
protected final BackgroundExecutor backgroundExecutor;
protected final NavigableSet<Long> idList = new TreeSet<>();
protected final int allocationSize;
protected AtomicBoolean currentlyBackgroundLoading = new AtomicBoolean(false);
/**
@@ -129,7 +120,7 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
protected void loadInBackground(final int requestSize) {
if (currentlyBackgroundLoading.get()) {
// skip as already background loading
logger.debug("... skip background sequence load (another load in progress)");
log.debug("... skip background sequence load (another load in progress)");
return;
}
currentlyBackgroundLoading.set(true);
@@ -161,8 +152,8 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
resultSet = statement.executeQuery();
List<Long> newIds = readIds(resultSet, requestSize);
if (logger.isTraceEnabled()) {
logger.trace("seq:{} loaded:{} sql:{}", seqName, newIds.size(), sql);
if (log.isTraceEnabled()) {
log.trace("seq:{} loaded:{} sql:{}", seqName, newIds.size(), sql);
}
if (newIds.isEmpty()) {
throw new PersistenceException("Always expecting more than 1 row from " + sql);
@@ -173,7 +164,7 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
} catch (SQLException e) {
if (e.getMessage().contains("Database is already closed")) {
String msg = "Error getting SEQ when DB shutting down " + e.getMessage();
logger.error(msg);
log.error(msg);
System.out.println(msg);
return Collections.emptyList();
} else {
@@ -2,8 +2,6 @@ package io.ebean.config.dbplatform;
import io.ebean.Transaction;
import io.ebean.util.JdbcClose;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.PersistenceException;
import javax.sql.DataSource;
@@ -20,12 +18,8 @@ import java.sql.SQLException;
*/
public class SimpleSequenceIdGenerator implements PlatformIdGenerator {
private static final Logger logger = LoggerFactory.getLogger(SimpleSequenceIdGenerator.class);
private final String sql;
private final DataSource dataSource;
private final String seqName;
/**
@@ -26,7 +26,6 @@ public class ClickHousePlatform extends DatabasePlatform {
this.booleanDbType = Types.INTEGER;
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("UInt8"));
// using unsigned as default types ...
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("UInt8", false));
dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("UInt16", false));
@@ -34,15 +33,13 @@ public class ClickHousePlatform extends DatabasePlatform {
dbTypeMap.put(DbType.BIGINT, new DbPlatformType("UInt64", false));
dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("Decimal", 16, 3));
dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("Float64", false));
dbTypeMap.put(DbType.DATE, new DbPlatformType("Date", false));
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("DateTime", false));
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("DateTime", false));
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("String", false));
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("String", false));
dbTypeMap.put(DbType.CLOB, new DbPlatformType("String", false));
dbTypeMap.put(DbType.JSONVARCHAR, new DbPlatformType("String", false));
dbTypeMap.put(DbType.UUID, new DbPlatformType("UUID", false));
dbTypeMap.put(DbType.INET, new DbPlatformType("String", false));
dbTypeMap.put(DbType.CIDR, new DbPlatformType("String", false));
@@ -12,7 +12,7 @@ import java.util.Arrays;
*/
public class H2HistoryTrigger implements Trigger {
private static final Logger logger = LoggerFactory.getLogger(H2HistoryTrigger.class);
private static final Logger log = LoggerFactory.getLogger(H2HistoryTrigger.class);
/**
* Hardcoding the column and history table suffix for now. Not sure how to get that
@@ -69,7 +69,7 @@ public class H2HistoryTrigger implements Trigger {
insertSql.append(");");
this.insertHistorySql = insertSql.toString();
logger.debug("History table insert sql: {}", insertHistorySql);
log.debug("History table insert sql: {}", insertHistorySql);
}
@Override
@@ -82,8 +82,8 @@ public class H2HistoryTrigger implements Trigger {
// update event. Set the effective start timestamp to now.
newRow[effectStartPosition] = now;
}
if (logger.isDebugEnabled()) {
logger.debug("History insert: {}", Arrays.toString(oldRow));
if (log.isTraceEnabled()) {
log.trace("History insert: {}", Arrays.toString(oldRow));
}
insertIntoHistory(connection, oldRow);
}
@@ -51,6 +51,7 @@ public abstract class BaseMySqlPlatform extends DatabasePlatform {
dbTypeMap.put(DbType.BIT, new DbPlatformType("tinyint(1)"));
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("tinyint(1)"));
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime(6)"));
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime(6)"));
dbTypeMap.put(DbType.CLOB, new MySqlClob());
dbTypeMap.put(DbType.BLOB, new MySqlBlob());
dbTypeMap.put(DbType.BINARY, new DbPlatformType("binary", 255));
@@ -10,5 +10,6 @@ public class MySql55Platform extends BaseMySqlPlatform {
super();
this.platform = Platform.MYSQL55;
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime"));
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime"));
}
}
@@ -69,22 +69,19 @@ public class PostgresPlatform extends DatabasePlatform {
DbPlatformType dbTypeText = new DbPlatformType("text", false);
DbPlatformType dbBytea = new DbPlatformType("bytea", false);
dbTypeMap.put(DbType.UUID, new DbPlatformType("uuid", false));
dbTypeMap.put(DbType.INET, new DbPlatformType("inet", false));
dbTypeMap.put(DbType.CIDR, new DbPlatformType("cidr", false));
dbTypeMap.put(DbType.HSTORE, new DbPlatformType("hstore", false));
dbTypeMap.put(DbType.JSON, new DbPlatformType("json", false));
dbTypeMap.put(DbType.JSONB, new DbPlatformType("jsonb", false));
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("float"));
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint"));
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("timestamptz"));
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("timestamp"));
dbTypeMap.put(DbType.BINARY, dbBytea);
dbTypeMap.put(DbType.VARBINARY, dbBytea);
dbTypeMap.put(DbType.BLOB, dbBytea);
dbTypeMap.put(DbType.CLOB, dbTypeText);
dbTypeMap.put(DbType.LONGVARBINARY, dbBytea);
@@ -21,6 +21,8 @@ public class SqlServer16Platform extends SqlServerBasePlatform {
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255));
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("text"));
dbTypeMap.put(DbType.CLOB, new DbPlatformType("text"));
dbTypeMap.put(DbType.JSON, new DbPlatformType("text"));
dbTypeMap.put(DbType.JSONB, new DbPlatformType("text"));
}
}
@@ -57,7 +57,6 @@ abstract class SqlServerBasePlatform extends DatabasePlatform {
this.dbDefaultValue.setTrue("1");
this.dbDefaultValue.setNow("SYSUTCDATETIME()");
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("bit"));
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
dbTypeMap.put(DbType.BIGINT, new DbPlatformType("numeric", 19));
dbTypeMap.put(DbType.REAL, new DbPlatformType("float(16)"));
@@ -67,16 +66,14 @@ abstract class SqlServerBasePlatform extends DatabasePlatform {
dbTypeMap.put(DbType.DATE, new DbPlatformType("date"));
dbTypeMap.put(DbType.TIME, new DbPlatformType("time"));
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime2"));
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime2"));
// UTF8 aware types - overwritten in SqlServer16 platform
dbTypeMap.put(DbType.CHAR, new DbPlatformType("nchar", 1));
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("nvarchar", 255));
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
dbTypeMap.put(DbType.CLOB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
dbTypeMap.put(DbType.JSON, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
dbTypeMap.put(DbType.JSONB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
dbTypeMap.put(DbType.BLOB, new DbPlatformType("image"));
dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image"));
}
@@ -20,18 +20,13 @@ import java.util.concurrent.locks.ReentrantLock;
*/
public final class ShutdownManager {
private static final Logger logger = LoggerFactory.getLogger(ShutdownManager.class);
private static final Logger log = LoggerFactory.getLogger("io.ebean");
private static final ReentrantLock lock = new ReentrantLock();
private static final List<Database> databases = new ArrayList<>();
private static final ShutdownHook shutdownHook = new ShutdownHook();
private static boolean stopping;
private static SpiContainer container;
static {
// Register the Shutdown hook
registerShutdownHook();
@@ -125,8 +120,8 @@ public final class ShutdownManager {
// Already run shutdown...
return;
}
if (logger.isDebugEnabled()) {
logger.debug("Shutting down");
if (log.isDebugEnabled()) {
log.debug("Ebean shutting down");
}
stopping = true;
deregisterShutdownHook();
@@ -138,7 +133,7 @@ public final class ShutdownManager {
Runnable r = (Runnable) ClassUtil.newInstance(shutdownRunner);
r.run();
} catch (Exception e) {
logger.error("Error running custom shutdown runnable", e);
log.error("Error running custom shutdown runnable", e);
}
}
@@ -152,7 +147,7 @@ public final class ShutdownManager {
try {
server.shutdown();
} catch (Exception ex) {
logger.error("Error executing shutdown runnable", ex);
log.error("Error executing shutdown runnable", ex);
ex.printStackTrace();
}
}
@@ -170,10 +165,10 @@ public final class ShutdownManager {
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
try {
logger.info("De-registering jdbc driver: " + driver);
log.info("De-registering jdbc driver: " + driver);
DriverManager.deregisterDriver(driver);
} catch (SQLException e) {
logger.error("Error de-registering driver " + driver, e);
log.error("Error de-registering driver " + driver, e);
}
}
}
@@ -8,7 +8,6 @@ import io.ebean.event.BeanPersistController;
import io.ebean.event.BeanPersistListener;
import io.ebean.event.BeanQueryAdapter;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;
@@ -21,7 +20,6 @@ public interface BeanType<T> {
/**
* Return the short name of the bean type.
*/
@Nonnull
String name();
/**
@@ -35,7 +33,6 @@ public interface BeanType<T> {
/**
* Return the full name of the bean type.
*/
@Nonnull
String fullName();
/**
@@ -49,7 +46,6 @@ public interface BeanType<T> {
/**
* Return the class type this BeanDescriptor describes.
*/
@Nonnull
Class<T> type();
/**
@@ -76,7 +72,6 @@ public interface BeanType<T> {
/**
* Return all the properties for this bean type.
*/
@Nonnull
Collection<? extends Property> allProperties();
/**
@@ -1,7 +1,5 @@
package io.ebean.plugin;
import javax.annotation.Nonnull;
/**
* Property of a entity bean that can be read.
*/
@@ -10,7 +8,6 @@ public interface Property {
/**
* Return the name of the property.
*/
@Nonnull
String name();
/**
@@ -24,7 +21,6 @@ public interface Property {
/**
* Return the type of the property.
*/
@Nonnull
Class<?> type();
/**
@@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
*/
public class DefaultCsvCallback<T> implements CsvCallback<T> {
private static final Logger logger = LoggerFactory.getLogger(DefaultCsvCallback.class);
private static final Logger log = LoggerFactory.getLogger(DefaultCsvCallback.class);
/**
* The transaction to use (if not using CsvCallback).
@@ -124,13 +124,11 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
*/
@Override
public void processBean(int row, String[] line, T bean) {
// assumes single bean or Cascade.PERSIST will save any
// related beans (e.g. customer -> customer.billingAddress
server.save(bean, transaction);
if (logInfoFrequency > 0 && (row % logInfoFrequency == 0)) {
logger.info("processed " + row + " rows");
log.debug("processed {} rows", row);
}
}
@@ -139,11 +137,9 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
*/
@Override
public void end(int row) {
commitTransactionIfCreated();
exeTime = System.currentTimeMillis() - startTime;
logger.info("Csv finished, rows[" + row + "] exeMillis[" + exeTime + "]");
log.info("Csv finished, rows[{}] exeMillis[{}]", row, exeTime);
}
/**
@@ -159,23 +155,20 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
* and batch size.
*/
protected void initTransactionIfRequired() {
transaction = server.currentTransaction();
if (transaction == null || !transaction.isActive()) {
transaction = server.beginTransaction();
createdTransaction = true;
if (persistBatchSize > 1) {
logger.info("Creating transaction, batchSize[" + persistBatchSize + "]");
log.debug("Creating transaction, batchSize[{}]", persistBatchSize);
transaction.setBatchMode(true);
transaction.setBatchSize(persistBatchSize);
transaction.setGetGeneratedKeys(false);
} else {
// explicitly turn off JDBC batching in case
// is has been turned on globally
transaction.setBatchMode(false);
logger.info("Creating transaction with no JDBC batching");
log.debug("Creating transaction with no JDBC batching");
}
}
}
@@ -187,7 +180,7 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
protected void commitTransactionIfCreated() {
if (createdTransaction) {
transaction.commit();
logger.info("Committed transaction");
log.debug("Committed transaction");
}
}
@@ -198,7 +191,7 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
protected void rollbackTransactionIfCreated(Throwable e) {
if (createdTransaction) {
transaction.rollback(e);
logger.info("Rolled back transaction");
log.debug("Rolled back transaction");
}
}
@@ -20,7 +20,7 @@ public interface JsonBeanReader<T> {
/**
* Create a new reader taking the context from the existing one but using a new JsonParser.
*/
JsonBeanReader<T> forJson(JsonParser moreJson, boolean resetContext);
JsonBeanReader<T> forJson(JsonParser moreJson);
/**
* Add a bean explicitly to the persistence context.
@@ -13,7 +13,7 @@ import java.sql.Statement;
*/
public class JdbcClose {
private static final Logger logger = LoggerFactory.getLogger(JdbcClose.class);
private static final Logger log = LoggerFactory.getLogger("io.ebean");
/**
* Close the resultSet logging if an error occurs.
@@ -24,7 +24,7 @@ public class JdbcClose {
statement.close();
}
} catch (SQLException e) {
logger.warn("Error closing statement", e);
log.warn("Error closing statement", e);
}
}
@@ -37,7 +37,7 @@ public class JdbcClose {
resultSet.close();
}
} catch (SQLException e) {
logger.warn("Error closing resultSet", e);
log.warn("Error closing resultSet", e);
}
}
@@ -50,7 +50,7 @@ public class JdbcClose {
connection.close();
}
} catch (SQLException e) {
logger.warn("Error closing connection", e);
log.warn("Error closing connection", e);
}
}
@@ -63,7 +63,7 @@ public class JdbcClose {
connection.rollback();
}
} catch (SQLException e) {
logger.warn("Error on connection rollback", e);
log.warn("Error on connection rollback", e);
}
}
@@ -76,7 +76,7 @@ public class JdbcClose {
stmt.cancel();
}
} catch (SQLException e) {
logger.warn("Error on cancelling statement", e);
log.warn("Error on cancelling statement", e);
}
}
}
+58
View File
@@ -0,0 +1,58 @@
module io.ebean.api {
uses io.ebean.config.AutoConfigure;
uses io.ebean.datasource.DataSourceAlertFactory;
uses io.ebean.metric.MetricFactory;
uses io.ebean.service.SpiContainerFactory;
uses io.ebean.service.SpiRawSqlService;
uses io.ebean.service.SpiProfileLocationFactory;
uses io.ebean.service.SpiFetchGroupService;
requires transitive java.sql;
requires transitive io.avaje.config;
requires transitive persistence.api;
requires transitive io.ebean.annotation;
requires transitive io.ebean.datasource.api;
requires transitive org.slf4j;
requires static io.ebean.types;
requires static io.avaje.jsr305x;
requires static com.fasterxml.jackson.core;
requires static javax.servlet.api;
requires static com.h2database;
exports io.ebean;
exports io.ebean.bean;
exports io.ebean.cache;
exports io.ebean.meta;
exports io.ebean.config;
exports io.ebean.config.dbplatform;
exports io.ebean.config.dbplatform.clickhouse;
exports io.ebean.config.dbplatform.h2;
exports io.ebean.config.dbplatform.db2;
exports io.ebean.config.dbplatform.cockroach;
exports io.ebean.config.dbplatform.hana;
exports io.ebean.config.dbplatform.hsqldb;
exports io.ebean.config.dbplatform.mariadb;
exports io.ebean.config.dbplatform.mysql;
exports io.ebean.config.dbplatform.nuodb;
exports io.ebean.config.dbplatform.oracle;
exports io.ebean.config.dbplatform.postgres;
exports io.ebean.config.dbplatform.sqlanywhere;
exports io.ebean.config.dbplatform.sqlite;
exports io.ebean.config.dbplatform.sqlserver;
exports io.ebean.event;
exports io.ebean.event.readaudit;
exports io.ebean.event.changelog;
exports io.ebean.common;
exports io.ebean.docstore;
exports io.ebean.plugin;
exports io.ebean.metric;
exports io.ebean.search;
exports io.ebean.service;
exports io.ebean.text;
exports io.ebean.text.json;
exports io.ebean.text.csv;
exports io.ebean.util;
}
@@ -1,2 +0,0 @@
Manifest-Version: 1.0
Automatic-Module-Name: io.ebean.api
@@ -0,0 +1,31 @@
package io.ebean;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
class EbeanVersionTest {
@Test
void checkMinAgentVersion_ok() {
assertFalse(EbeanVersion.checkMinAgentVersion("12.12.0"));
assertFalse(EbeanVersion.checkMinAgentVersion("12.12.99"));
assertFalse(EbeanVersion.checkMinAgentVersion("13.1.0"));
}
@Test
void checkMinAgentVersion_agentTooOld() {
assertTrue(EbeanVersion.checkMinAgentVersion("11.13.0"));
assertTrue(EbeanVersion.checkMinAgentVersion("12.11.0"));
assertTrue(EbeanVersion.checkMinAgentVersion("12.11.99"));
}
@Test
void checkMinAgentVersion_unexpectedAgentVersion() {
assertTrue(EbeanVersion.checkMinAgentVersion("13.13"));
assertTrue(EbeanVersion.checkMinAgentVersion("13"));
assertTrue(EbeanVersion.checkMinAgentVersion(""));
}
}
+4 -15
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.11.5</version>
<version>12.12.3</version>
</parent>
<!-- <parent>-->
<!-- <groupId>org.avaje</groupId>-->
@@ -14,7 +14,7 @@
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-12.11.5</tag>
<tag>ebean-parent-12.12.3</tag>
</scm>
<name>ebean autotune</name>
@@ -26,7 +26,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
<scope>provided</scope>
</dependency>
@@ -63,23 +63,12 @@
<extensions>true</extensions>
<configuration>
<tiles>
<!-- other tiles ... -->
<tile>io.ebean.tile:enhancement:12.11.3</tile>
<tile>io.avaje.tile:moditech-module:1.0</tile>
</tiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,15 @@
import io.ebeaninternal.server.autotune.AutoTuneServiceProvider;
import io.ebeaninternal.server.autotune.service.AutoTuneServiceFactory;
/**
* Provider of AutoTuneServiceProvider
*/
module io.ebean.autotune {
provides AutoTuneServiceProvider with AutoTuneServiceFactory;
requires io.ebean.api;
requires io.ebean.core;
requires java.xml;
requires java.xml.bind;
}
@@ -1,2 +0,0 @@
Manifest-Version: 1.0
Automatic-Module-Name: io.ebean.autotune
+15 -15
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.11.5</version>
<version>12.12.3</version>
</parent>
<name>ebean bom</name>
@@ -71,88 +71,88 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-xml</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-autotune</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>kotlin-querybean-generator</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-redis</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
</dependencies>
+17 -2
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.11.5</version>
<version>12.12.3</version>
</parent>
<artifactId>ebean-core-type</artifactId>
@@ -16,7 +16,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
@@ -28,4 +28,19 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.24</version>
<extensions>true</extensions>
<configuration>
<tiles>
<tile>io.avaje.tile:moditech-module:1.0</tile>
</tiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,10 @@
module io.ebean.core.type {
exports io.ebean.core.type;
requires transitive java.sql;
requires transitive io.ebean.api;
requires static com.fasterxml.jackson.core;
}
+19 -18
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.11.5</version>
<version>12.12.3</version>
</parent>
<artifactId>ebean-core</artifactId>
@@ -15,7 +15,7 @@
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-12.11.5</tag>
<tag>ebean-parent-12.12.3</tag>
</scm>
<dependencies>
@@ -29,7 +29,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>classpath-scanner</artifactId>
<version>6.1</version>
<version>6.2</version>
</dependency>
<dependency>
@@ -41,19 +41,19 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>12.11.5</version>
<version>12.12.3</version>
</dependency>
<dependency>
@@ -136,7 +136,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.20</version>
<version>42.2.24</version>
<optional>true</optional>
</dependency>
@@ -207,17 +207,6 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -239,6 +228,18 @@
</executions>
</plugin>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.24</version>
<extensions>true</extensions>
<configuration>
<tiles>
<tile>io.avaje.tile:moditech-module:1.0</tile>
</tiles>
</configuration>
</plugin>
</plugins>
</build>
@@ -285,12 +285,17 @@ public final class BindParams implements Serializable {
*/
public boolean isSameBindHash() {
if (bindHash == null) {
bindHash = calcQueryPlanHash();
return false;
}
String oldPlan = bindHash;
String newHash = calcQueryPlanHash();
return bindHash.equals(newHash);
}
/**
* Updates the hash.
*/
public void updateHash() {
bindHash = calcQueryPlanHash();
return bindHash.equals(oldPlan);
}
/**
@@ -1,6 +1,6 @@
package io.ebeaninternal.api;
import io.ebeaninternal.server.expression.IdInExpression;
import io.ebeaninternal.server.expression.IdInCommon;
import java.util.ArrayList;
import java.util.Collection;
@@ -13,10 +13,10 @@ import java.util.Set;
*/
public final class CacheIdLookupMany<T> implements CacheIdLookup<T> {
private final IdInExpression idInExpression;
private final IdInCommon idInExpression;
private int remaining;
public CacheIdLookupMany(IdInExpression idInExpression) {
public CacheIdLookupMany(IdInCommon idInExpression) {
this.idInExpression = idInExpression;
}
@@ -34,15 +34,12 @@ public final class CacheIdLookupMany<T> implements CacheIdLookup<T> {
*/
@Override
public List<T> removeHits(BeanCacheResult<T> cacheResult) {
Set<Object> hitIds = new HashSet<>();
List<T> beans = new ArrayList<>(hitIds.size());
for (BeanCacheResult.Entry<T> hit : cacheResult.hits()) {
hitIds.add(hit.getKey());
beans.add(hit.getBean());
}
this.remaining = idInExpression.removeIds(hitIds);
return beans;
}
@@ -0,0 +1,13 @@
package io.ebeaninternal.api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Common loggers used in ebean-core.
*/
public final class CoreLog {
public static final Logger log = LoggerFactory.getLogger("io.ebean.core");
public static final Logger internal = LoggerFactory.getLogger("io.ebean.internal");
}
@@ -36,14 +36,6 @@ public interface LoadContext {
*/
PersistenceContext getPersistenceContext();
/**
* Set the persistence context used by this query and future lazy loading.
* <p>
* Used by query iterator when processing large result sets.
* </p>
*/
void resetPersistenceContext(PersistenceContext persistenceContext);
/**
* Register a Bean for lazy loading.
*/
@@ -8,7 +8,6 @@ import io.ebeaninternal.server.core.OrmQueryRequest;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
@@ -18,7 +17,7 @@ import java.util.List;
*/
public final class LoadManyRequest extends LoadRequest {
private static final Logger logger = LoggerFactory.getLogger(LoadManyRequest.class);
private static final Logger log = CoreLog.log;
private final List<BeanCollection<?>> batch;
private final LoadManyBuffer loadContext;
@@ -114,10 +113,10 @@ public final class LoadManyRequest extends LoadRequest {
// in the +query or +lazy load due to no rows (predicates)
for (BeanCollection<?> bc : batch) {
if (bc.checkEmptyLazyLoad()) {
if (logger.isDebugEnabled()) {
if (log.isDebugEnabled()) {
EntityBean ownerBean = bc.getOwnerBean();
Object parentId = desc.getId(ownerBean);
logger.debug("BeanCollection after lazy load was empty. type:" + ownerBean.getClass().getName() + " id:" + parentId + " owner:" + ownerBean);
log.debug("BeanCollection after lazy load was empty. type:" + ownerBean.getClass().getName() + " id:" + parentId + " owner:" + ownerBean);
}
} else if (loadCache && many.isUseCache()) {
desc.cacheManyPropPut(many, bc, desc.getId(bc.getOwnerBean()));
@@ -16,6 +16,7 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.query.CQuery;
import io.ebeaninternal.server.transaction.RemoteTransactionEvent;
import javax.annotation.Nullable;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -141,7 +142,7 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, EbeanServer,
/**
* Compile a query.
*/
<T> CQuery<T> compileQuery(Type type, Query<T> query, Transaction t);
<T> CQuery<T> compileQuery(Type type, Query<T> query, Transaction transaction);
/**
* Execute the findId's query but without copying the query.
@@ -150,12 +151,12 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, EbeanServer,
* the query has finished (if executing in a background thread).
* </p>
*/
<A, T> List<A> findIdsWithCopy(Query<T> query, Transaction t);
<A, T> List<A> findIdsWithCopy(Query<T> query, Transaction transaction);
/**
* Execute the findCount query but without copying the query.
*/
<T> int findCountWithCopy(Query<T> query, Transaction t);
<T> int findCountWithCopy(Query<T> query, Transaction transaction);
/**
* Load a batch of Associated One Beans.
@@ -257,6 +258,7 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, EbeanServer,
/**
* DTO findOne query.
*/
@Nullable
<T> T findDtoOne(SpiDtoQuery<T> query);
/**
@@ -20,17 +20,17 @@ public interface SpiTransactionManager {
/**
* Return the main DataSource.
*/
DataSource getDataSource();
DataSource dataSource();
/**
* Return the read only DataSource (if defined).
*/
DataSource getReadOnlyDataSource();
DataSource readOnlyDataSource();
/**
* Return the currently active transaction (can be null).
*/
SpiTransaction getActive();
SpiTransaction active();
/**
* Push an externally managed transaction into scope (e.g. Spring managed transaction).
@@ -60,6 +60,6 @@ public interface SpiTransactionManager {
/**
* Return a connection used for query plan collection.
*/
Connection getQueryPlanConnection() throws SQLException;
Connection queryPlanConnection() throws SQLException;
}
@@ -114,7 +114,7 @@ public final class TransactionEvent implements Serializable {
}
if (eventTables != null && !eventTables.isEmpty()) {
// notify cache with table based changes
BeanDescriptorManager dm = manager.getBeanDescriptorManager();
BeanDescriptorManager dm = manager.descriptorManager();
for (TransactionEventTable.TableIUD tableIUD : eventTables.values()) {
dm.cacheNotify(tableIUD, changeSet);
}
@@ -14,7 +14,7 @@ public interface SpiJsonReader {
PersistenceContext getPersistenceContext();
SpiJsonReader forJson(JsonParser moreJson, boolean resetContext);
SpiJsonReader forJson(JsonParser moreJson);
<T> void persistenceContextPut(Object beanId, T currentBean);
@@ -6,6 +6,7 @@ import io.ebean.event.changelog.ChangeSet;
import io.ebean.event.changelog.ChangeType;
import io.ebean.plugin.Plugin;
import io.ebean.plugin.SpiServer;
import io.ebeaninternal.api.CoreLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -17,11 +18,6 @@ import java.util.Properties;
*/
public final class DefaultChangeLogListener implements ChangeLogListener, Plugin {
/**
* The usual application specific logger.
*/
private static final Logger logger = LoggerFactory.getLogger(DefaultChangeLogListener.class);
/**
* The named logger we send the change set payload to. Can be externally configured as desired.
*/
@@ -37,9 +33,6 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
*/
private int defaultBufferSize = 400;
public DefaultChangeLogListener() {
}
/**
* Configure the underlying JSON handler.
*/
@@ -67,7 +60,6 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
@Override
public void log(ChangeSet changeSet) {
for (BeanChange beanChange : changeSet.getChanges()) {
// log each bean change as a separate log entry
try {
@@ -75,7 +67,7 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
jsonBuilder.writeBeanJson(writer, beanChange, changeSet);
changeLog.info(writer.toString());
} catch (Exception e) {
logger.error("Exception logging beanChange " + beanChange.toString(), e);
CoreLog.log.error("Exception logging beanChange " + beanChange, e);
}
}
}
@@ -84,7 +76,6 @@ public final class DefaultChangeLogListener implements ChangeLogListener, Plugin
* Return a decent buffer size based on the bean change.
*/
private int getBufferSize(BeanChange beanChange) {
return ChangeType.DELETE == beanChange.getEvent() ? 250 : defaultBufferSize;
}
@@ -1,19 +1,16 @@
package io.ebeaninternal.server.core;
import io.ebean.EbeanServer;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiTransaction;
import io.ebeaninternal.server.core.timezone.DataTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Base class for find and persist requests.
*/
public abstract class BeanRequest {
static final Logger log = LoggerFactory.getLogger(BeanRequest.class);
protected final SpiEbeanServer server;
protected SpiTransaction transaction;
protected boolean createdTransaction;
@@ -64,7 +61,7 @@ public abstract class BeanRequest {
// Just log this and carry on. A previous exception has been
// thrown and if this rollback throws exception it likely means
// that the connection is broken (and the dataSource and db will cleanup)
log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
CoreLog.log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
}
}
}
@@ -5,7 +5,9 @@ import io.avaje.classpath.scanner.ClassPathScannerFactory;
import io.ebean.config.DatabaseConfig;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
/**
* Utility to finds and return the list of ClassPathScanner services.
@@ -17,7 +19,7 @@ public class ClassPathScanners {
*/
public static List<ClassPathScanner> find(DatabaseConfig config) {
List<ClassPathScanner> scanners = new ArrayList<>();
for (ClassPathScannerFactory factory : config.serviceLoad(ClassPathScannerFactory.class)) {
for (ClassPathScannerFactory factory : ServiceLoader.load(ClassPathScannerFactory.class)) {
scanners.add(factory.createScanner(config.getClassLoadConfig().getClassLoader()));
}
return scanners;
@@ -20,10 +20,8 @@ import io.ebean.config.dbplatform.sqlanywhere.SqlAnywherePlatform;
import io.ebean.config.dbplatform.sqlite.SQLitePlatform;
import io.ebean.config.dbplatform.sqlserver.SqlServer16Platform;
import io.ebean.config.dbplatform.sqlserver.SqlServer17Platform;
import io.ebean.util.JdbcClose;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.api.DbOffline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.PersistenceException;
import javax.sql.DataSource;
@@ -41,8 +39,6 @@ import java.sql.SQLException;
*/
public class DatabasePlatformFactory {
private static final Logger logger = LoggerFactory.getLogger(DatabasePlatformFactory.class);
/**
* Create the appropriate database specific platform.
*/
@@ -50,7 +46,7 @@ public class DatabasePlatformFactory {
try {
String offlinePlatform = DbOffline.getPlatform();
if (offlinePlatform != null) {
logger.info("offline platform [{}]", offlinePlatform);
CoreLog.log.info("offline platform [{}]", offlinePlatform);
return byDatabaseName(offlinePlatform);
}
if (config.getDatabasePlatformName() != null) {
@@ -142,7 +138,7 @@ public class DatabasePlatformFactory {
String dbProductName = metaData.getDatabaseProductName().toLowerCase();
final int majorVersion = metaData.getDatabaseMajorVersion();
final int minorVersion = metaData.getDatabaseMinorVersion();
logger.debug("platform for productName[{}] version[{}.{}]", dbProductName, majorVersion, minorVersion);
CoreLog.log.debug("platform for productName[{}] version[{}.{}]", dbProductName, majorVersion, minorVersion);
if (dbProductName.contains("oracle")) {
return oracleVersion(majorVersion);
@@ -201,7 +197,7 @@ public class DatabasePlatformFactory {
}
}
} catch (SQLException e) {
logger.warn("Error running detection query on Postgres", e);
CoreLog.log.warn("Error running detection query on Postgres", e);
}
if (majorVersion <= 9) {
return new Postgres9Platform();
@@ -7,18 +7,13 @@ import io.ebean.bean.BeanCollection;
import io.ebean.bean.EntityBean;
import io.ebean.bean.EntityBeanIntercept;
import io.ebean.bean.PersistenceContext;
import io.ebeaninternal.api.LoadBeanRequest;
import io.ebeaninternal.api.LoadManyRequest;
import io.ebeaninternal.api.LoadRequest;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.api.*;
import io.ebeaninternal.api.SpiQuery.Mode;
import io.ebeaninternal.api.SpiTransaction;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.EntityNotFoundException;
import java.util.List;
@@ -28,7 +23,7 @@ import java.util.List;
*/
final class DefaultBeanLoader {
private static final Logger logger = LoggerFactory.getLogger(DefaultBeanLoader.class);
private static final Logger log = CoreLog.internal;
private final DefaultServer server;
private final boolean onIterateUseExtraTxn;
@@ -113,8 +108,8 @@ final class DefaultBeanLoader {
server.findOne(query, t);
if (beanCollection != null) {
if (beanCollection.checkEmptyLazyLoad()) {
if (logger.isDebugEnabled()) {
logger.debug("BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
if (log.isDebugEnabled()) {
log.debug("BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
}
} else if (useManyIdCache) {
parentDesc.cacheManyPropPut(many, beanCollection, parentId);
@@ -12,6 +12,7 @@ import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebean.config.dbplatform.h2.H2Platform;
import io.ebean.event.ShutdownManager;
import io.ebean.service.SpiContainer;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.api.DbOffline;
import io.ebeaninternal.api.SpiBackgroundExecutor;
import io.ebeaninternal.api.SpiEbeanServer;
@@ -20,7 +21,6 @@ import io.ebeaninternal.server.core.bootup.BootupClassPathSearch;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.executor.DefaultBackgroundExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.PersistenceException;
import java.sql.Connection;
@@ -34,7 +34,7 @@ import java.util.concurrent.locks.ReentrantLock;
*/
public final class DefaultContainer implements SpiContainer {
private static final Logger logger = LoggerFactory.getLogger("io.ebean.DB");
private static final Logger log = CoreLog.log;
private final ReentrantLock lock = new ReentrantLock();
private final ClusterManager clusterManager;
@@ -113,7 +113,7 @@ public final class DefaultContainer implements SpiContainer {
startServer(online, server);
}
DbOffline.reset();
logger.info("started database[{}] platform[{}] in {}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
log.info("Started database[{}] platform[{}] in {}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
return server;
} finally {
lock.unlock();
@@ -215,7 +215,7 @@ public final class DefaultContainer implements SpiContainer {
*/
private void setDataSource(DatabaseConfig config) {
if (isOfflineMode(config)) {
logger.debug("... DbOffline using platform [{}]", DbOffline.getPlatform());
log.debug("... DbOffline using platform [{}]", DbOffline.getPlatform());
} else {
InitDataSource.init(config);
}
@@ -251,7 +251,7 @@ public final class DefaultContainer implements SpiContainer {
}
try (Connection connection = config.getDataSource().getConnection()) {
if (connection.getAutoCommit()) {
logger.warn("DataSource [{}] has autoCommit defaulting to true!", config.getName());
log.warn("DataSource [{}] has autoCommit defaulting to true!", config.getName());
}
return true;
} catch (SQLException ex) {
File diff suppressed because it is too large Load Diff
@@ -124,7 +124,7 @@ final class InitDataSource {
* Attach DataSourceAlert via service loader if present.
*/
private void attachAlert(DataSourceConfig dsConfig) {
DataSourceAlertFactory alertFactory = config.service(DataSourceAlertFactory.class);
DataSourceAlertFactory alertFactory = ServiceUtil.service(DataSourceAlertFactory.class);
if (alertFactory != null) {
dsConfig.setAlert(alertFactory.createAlert());
}
@@ -1,11 +1,10 @@
package io.ebeaninternal.server.core;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.dto.DtoNamedQueries;
import io.ebeaninternal.xmapping.api.XmapDto;
import io.ebeaninternal.xmapping.api.XmapEbean;
import io.ebeaninternal.xmapping.api.XmapRawSql;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.List;
@@ -16,8 +15,6 @@ import java.util.Map;
*/
final class InternalConfigXmlMap {
private static final Logger log = LoggerFactory.getLogger(InternalConfigXmlMap.class);
private final List<XmapEbean> xmlEbeanList;
private final ClassLoader classLoader;
private final Map<Class<?>, DtoNamedQueries> dtoNamedQueries = new HashMap<>();
@@ -58,7 +55,7 @@ final class InternalConfigXmlMap {
try {
dtoClass = Class.forName(dto.getClazz(), false, classLoader);
} catch (Exception e) {
log.error("Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
CoreLog.internal.error("Could not load dto bean class " + dto.getClazz() + " for ebean xml entry");
return;
}
DtoNamedQueries namedQueries = dtoNamedQueries.computeIfAbsent(dtoClass, aClass -> new DtoNamedQueries());
@@ -3,12 +3,7 @@ package io.ebeaninternal.server.core;
import com.fasterxml.jackson.core.JsonFactory;
import io.ebean.ExpressionFactory;
import io.ebean.annotation.Platform;
import io.ebean.cache.ServerCacheFactory;
import io.ebean.cache.ServerCacheManager;
import io.ebean.cache.ServerCacheNotify;
import io.ebean.cache.ServerCacheNotifyPlugin;
import io.ebean.cache.ServerCacheOptions;
import io.ebean.cache.ServerCachePlugin;
import io.ebean.cache.*;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.ExternalTransactionManager;
import io.ebean.config.ProfilingConfig;
@@ -22,36 +17,17 @@ import io.ebean.event.readaudit.ReadAuditLogger;
import io.ebean.event.readaudit.ReadAuditPrepare;
import io.ebean.plugin.Plugin;
import io.ebean.plugin.SpiServer;
import io.ebeaninternal.api.DbOffline;
import io.ebeaninternal.api.ExtraMetrics;
import io.ebeaninternal.api.QueryPlanManager;
import io.ebeaninternal.api.SpiBackgroundExecutor;
import io.ebeaninternal.api.SpiDdlGenerator;
import io.ebeaninternal.api.SpiDdlGeneratorProvider;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiJsonContext;
import io.ebeaninternal.api.SpiLogManager;
import io.ebeaninternal.api.SpiLogger;
import io.ebeaninternal.api.SpiLoggerFactory;
import io.ebeaninternal.api.SpiProfileHandler;
import io.ebeaninternal.api.*;
import io.ebeaninternal.server.autotune.AutoTuneService;
import io.ebeaninternal.server.autotune.AutoTuneServiceProvider;
import io.ebeaninternal.server.autotune.NoAutoTuneService;
import io.ebeaninternal.server.cache.CacheManagerOptions;
import io.ebeaninternal.server.cache.DefaultCacheAdapter;
import io.ebeaninternal.server.cache.DefaultServerCacheManager;
import io.ebeaninternal.server.cache.DefaultServerCachePlugin;
import io.ebeaninternal.server.cache.SpiCacheManager;
import io.ebeaninternal.server.cache.*;
import io.ebeaninternal.server.changelog.DefaultChangeLogListener;
import io.ebeaninternal.server.changelog.DefaultChangeLogPrepare;
import io.ebeaninternal.server.changelog.DefaultChangeLogRegister;
import io.ebeaninternal.server.cluster.ClusterManager;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.core.timezone.DataTimeZone;
import io.ebeaninternal.server.core.timezone.MySqlDataTimeZone;
import io.ebeaninternal.server.core.timezone.NoDataTimeZone;
import io.ebeaninternal.server.core.timezone.OracleDataTimeZone;
import io.ebeaninternal.server.core.timezone.SimpleDataTimeZone;
import io.ebeaninternal.server.core.timezone.*;
import io.ebeaninternal.server.deploy.BeanDescriptorManager;
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedPropertyFactory;
import io.ebeaninternal.server.deploy.parse.DeployCreateProperties;
@@ -67,30 +43,11 @@ import io.ebeaninternal.server.persist.Binder;
import io.ebeaninternal.server.persist.DefaultPersister;
import io.ebeaninternal.server.persist.platform.MultiValueBind;
import io.ebeaninternal.server.persist.platform.PostgresMultiValueBind;
import io.ebeaninternal.server.query.CQueryEngine;
import io.ebeaninternal.server.query.CQueryPlanManager;
import io.ebeaninternal.server.query.DefaultOrmQueryEngine;
import io.ebeaninternal.server.query.DefaultRelationalQueryEngine;
import io.ebeaninternal.server.query.DtoQueryEngine;
import io.ebeaninternal.server.query.QueryPlanLogger;
import io.ebeaninternal.server.query.QueryPlanLoggerExplain;
import io.ebeaninternal.server.query.QueryPlanLoggerOracle;
import io.ebeaninternal.server.query.QueryPlanLoggerPostgres;
import io.ebeaninternal.server.query.QueryPlanLoggerSqlServer;
import io.ebeaninternal.server.query.*;
import io.ebeaninternal.server.readaudit.DefaultReadAuditLogger;
import io.ebeaninternal.server.readaudit.DefaultReadAuditPrepare;
import io.ebeaninternal.server.text.json.DJsonContext;
import io.ebeaninternal.server.transaction.DataSourceSupplier;
import io.ebeaninternal.server.transaction.DefaultProfileHandler;
import io.ebeaninternal.server.transaction.DefaultTransactionScopeManager;
import io.ebeaninternal.server.transaction.DocStoreTransactionManager;
import io.ebeaninternal.server.transaction.ExternalTransactionScopeManager;
import io.ebeaninternal.server.transaction.JtaTransactionManager;
import io.ebeaninternal.server.transaction.NoopProfileHandler;
import io.ebeaninternal.server.transaction.TableModState;
import io.ebeaninternal.server.transaction.TransactionManager;
import io.ebeaninternal.server.transaction.TransactionManagerOptions;
import io.ebeaninternal.server.transaction.TransactionScopeManager;
import io.ebeaninternal.server.transaction.*;
import io.ebeaninternal.server.type.DefaultTypeManager;
import io.ebeaninternal.server.type.TypeManager;
import io.ebeaninternal.xmapping.api.XmapEbean;
@@ -100,14 +57,8 @@ import io.ebeanservice.docstore.api.DocStoreIntegration;
import io.ebeanservice.docstore.api.DocStoreUpdateProcessor;
import io.ebeanservice.docstore.none.NoneDocStoreFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.*;
/**
* Used to extend the DatabaseConfig with additional objects used to configure and
@@ -115,7 +66,7 @@ import java.util.ServiceLoader;
*/
public final class InternalConfiguration {
private static final Logger logger = LoggerFactory.getLogger(InternalConfiguration.class);
private static final Logger log = CoreLog.internal;
private final TableModState tableModState;
private final boolean online;
@@ -156,7 +107,7 @@ public final class InternalConfiguration {
this.clockService = new ClockService(config.getClock());
this.tableModState = new TableModState();
this.logManager = initLogManager();
this.docStoreFactory = initDocStoreFactory(config.service(DocStoreFactory.class));
this.docStoreFactory = initDocStoreFactory(service(DocStoreFactory.class));
this.jsonFactory = config.getJsonFactory();
this.clusterManager = clusterManager;
this.backgroundExecutor = backgroundExecutor;
@@ -191,8 +142,12 @@ public final class InternalConfiguration {
return new InternalConfigXmlMap(xmEbeans, config.getClassLoadConfig().getClassLoader());
}
private <S> S service(Class<S> cls) {
return ServiceUtil.service(cls);
}
private List<XmapEbean> readExternalMapping() {
final XmapService xmapService = config.service(XmapService.class);
final XmapService xmapService = service(XmapService.class);
if (xmapService == null) {
return Collections.emptyList();
}
@@ -201,7 +156,7 @@ public final class InternalConfiguration {
private SpiLogManager initLogManager() {
// allow plugin - i.e. capture executed SQL for testing/asserts
SpiLoggerFactory loggerFactory = config.service(SpiLoggerFactory.class);
SpiLoggerFactory loggerFactory = service(SpiLoggerFactory.class);
if (loggerFactory == null) {
loggerFactory = new DLoggerFactory();
}
@@ -336,7 +291,7 @@ public final class InternalConfiguration {
}
AutoTuneService createAutoTuneService(SpiEbeanServer server) {
final AutoTuneServiceProvider provider = config.service(AutoTuneServiceProvider.class);
final AutoTuneServiceProvider provider = service(AutoTuneServiceProvider.class);
return provider == null ? new NoAutoTuneService() : provider.create(server, config);
}
@@ -445,7 +400,7 @@ public final class InternalConfiguration {
if (!profilingConfig.isEnabled()) {
return new NoopProfileHandler();
}
SpiProfileHandler handler = config.service(SpiProfileHandler.class);
SpiProfileHandler handler = service(SpiProfileHandler.class);
if (handler == null) {
handler = new DefaultProfileHandler(profilingConfig);
}
@@ -478,7 +433,7 @@ public final class InternalConfiguration {
externalTransactionManager = new JtaTransactionManager();
}
if (externalTransactionManager != null) {
logger.info("Using Transaction Manager [" + externalTransactionManager.getClass() + "]");
log.info("Using Transaction Manager [" + externalTransactionManager.getClass() + "]");
return new ExternalTransactionScopeManager(externalTransactionManager);
} else {
return new DefaultTransactionScopeManager();
@@ -533,7 +488,7 @@ public final class InternalConfiguration {
}
SlowQueryListener listener = config.getSlowQueryListener();
if (listener == null) {
listener = config.service(SlowQueryListener.class);
listener = service(SlowQueryListener.class);
if (listener == null) {
listener = new DefaultSlowQueryListener();
}
@@ -568,7 +523,7 @@ public final class InternalConfiguration {
if (iterator.hasNext()) {
// use the cacheFactory (via classpath service loader)
plugin = iterator.next();
logger.debug("using ServerCacheFactory {}", plugin.getClass());
log.debug("using ServerCacheFactory {}", plugin.getClass());
} else {
// use the built in default l2 caching which is local cache based
localL2Caching = true;
@@ -589,7 +544,7 @@ public final class InternalConfiguration {
}
ServerCacheFactory factory = serverCachePlugin.create(config, backgroundExecutor);
ServerCacheNotifyPlugin notifyPlugin = config.service(ServerCacheNotifyPlugin.class);
ServerCacheNotifyPlugin notifyPlugin = service(ServerCacheNotifyPlugin.class);
if (notifyPlugin != null) {
// plugin supplied so use that to send notifications
cacheNotify = notifyPlugin.create(config);
@@ -644,14 +599,21 @@ public final class InternalConfiguration {
* Return the DDL generator.
*/
public SpiDdlGenerator initDdlGenerator(SpiEbeanServer server) {
final SpiDdlGeneratorProvider service = config.service(SpiDdlGeneratorProvider.class);
return service == null ? new NoopDdl() : service.generator(server);
final SpiDdlGeneratorProvider service = service(SpiDdlGeneratorProvider.class);
return service == null ? new NoopDdl(server.config().isDdlRun()) : service.generator(server);
}
private static class NoopDdl implements SpiDdlGenerator {
private final boolean ddlRun;
NoopDdl(boolean ddlRun) {
this.ddlRun = ddlRun;
}
@Override
public void execute(boolean online) {
// do nothing
if (online && ddlRun) {
CoreLog.log.error("Configured to run DDL but ebean-ddl-generator is not in the classpath (or ebean-test in the test classpath?)");
}
}
}
}
@@ -1,13 +1,7 @@
package io.ebeaninternal.server.core;
import io.ebean.CacheMode;
import io.ebean.CancelableQuery;
import io.ebean.OrderBy;
import io.ebean.PersistenceContextScope;
import io.ebean.QueryIterator;
import io.ebean.Version;
import io.ebean.*;
import io.ebean.bean.BeanCollection;
import io.ebean.bean.EntityBean;
import io.ebean.bean.PersistenceContext;
import io.ebean.cache.QueryCacheEntry;
import io.ebean.common.BeanList;
@@ -16,39 +10,17 @@ import io.ebean.common.CopyOnFirstWriteList;
import io.ebean.event.BeanFindController;
import io.ebean.event.BeanQueryAdapter;
import io.ebean.text.json.JsonReadOptions;
import io.ebeaninternal.api.BeanCacheResult;
import io.ebeaninternal.api.CQueryPlanKey;
import io.ebeaninternal.api.CacheIdLookup;
import io.ebeaninternal.api.HashQuery;
import io.ebeaninternal.api.LoadContext;
import io.ebeaninternal.api.NaturalKeyQueryData;
import io.ebeaninternal.api.NaturalKeySet;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.api.*;
import io.ebeaninternal.api.SpiQuery.Type;
import io.ebeaninternal.api.SpiQuerySecondary;
import io.ebeaninternal.api.SpiTransaction;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.deploy.BeanProperty;
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
import io.ebeaninternal.server.deploy.DeployParser;
import io.ebeaninternal.server.deploy.DeployPropertyParserMap;
import io.ebeaninternal.server.deploy.*;
import io.ebeaninternal.server.el.ElPropertyValue;
import io.ebeaninternal.server.loadcontext.DLoadContext;
import io.ebeaninternal.server.query.CQueryPlan;
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.PersistenceException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -57,8 +29,6 @@ import java.util.function.Predicate;
*/
public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQueryRequest<T> {
private static final Logger log = LoggerFactory.getLogger(OrmQueryRequest.class);
private final BeanDescriptor<T> beanDescriptor;
private final OrmQueryEngine queryEngine;
private final SpiQuery<T> query;
@@ -230,14 +200,6 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
return persistenceContext;
}
/**
* Add the bean to the persistence context.
*/
public void persistenceContextAdd(EntityBean bean) {
Object id = beanDescriptor.getId(bean);
beanDescriptor.contextPut(persistenceContext, id, bean);
}
/**
* This will create a local (readOnly) transaction if no current transaction
* exists.
@@ -262,6 +224,9 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
createdTransaction = true;
}
persistenceContext = persistenceContext(query, transaction);
if (Type.ITERATE == query.getType()) {
persistenceContext.beginIterate();
}
loadContext = new DLoadContext(this, secondaryQueries);
}
@@ -270,6 +235,9 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
*/
@Override
public void rollbackTransIfRequired() {
if (Type.ITERATE == query.getType()) {
persistenceContext.endIterate();
}
if (createdTransaction) {
try {
transaction.end();
@@ -277,7 +245,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
// Just log this and carry on. A previous exception has been
// thrown and if this rollback throws exception it likely means
// that the connection is broken (and the dataSource and db will cleanup)
log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
CoreLog.log.error("Error trying to rollback a transaction (after a prior exception thrown)", e);
}
}
}
@@ -300,20 +268,6 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
return jsonRead;
}
/**
* For iterate queries reset the persistenceContext and loadContext.
*/
public void flushPersistenceContextOnIterate() {
if (persistenceContext.resetLimit()) {
persistenceContext = persistenceContext.forIterateReset();
loadContext.resetPersistenceContext(persistenceContext);
if (jsonRead != null) {
jsonRead.setPersistenceContext(persistenceContext);
jsonRead.setLoadContext(loadContext);
}
}
}
/**
* Get the TransactionContext either explicitly set on the query or
* transaction scoped.
@@ -329,11 +283,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
if (scope == PersistenceContextScope.QUERY || t == null) {
return new DefaultPersistenceContext();
}
if (Type.ITERATE == query.getType()) {
return t.getPersistenceContext().forIterate();
} else {
return t.getPersistenceContext();
}
return t.getPersistenceContext();
}
/**
@@ -343,6 +293,9 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
*/
@Override
public void endTransIfRequired() {
if (Type.ITERATE == query.getType()) {
persistenceContext.endIterate();
}
if (createdTransaction && transaction.isActive()) {
transaction.commit();
if (query.getType().isUpdate()) {
@@ -619,7 +572,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
private ElPropertyValue mapProperty() {
ElPropertyValue property = beanDescriptor.elGetValue(query.getMapKey());
if (property == null) {
throw new IllegalStateException("Unknown map key property "+query.getMapKey());
throw new IllegalStateException("Unknown map key property " + query.getMapKey());
}
return property;
}
@@ -0,0 +1,13 @@
package io.ebeaninternal.server.core;
import java.util.Iterator;
import java.util.ServiceLoader;
public final class ServiceUtil {
public static <S> S service(Class<S> cls) {
ServiceLoader<S> load = ServiceLoader.load(cls);
Iterator<S> serviceInstances = load.iterator();
return serviceInstances.hasNext() ? serviceInstances.next() : null;
}
}
@@ -2,9 +2,9 @@ package io.ebeaninternal.server.core.bootup;
import io.avaje.classpath.scanner.ClassPathScanner;
import io.ebean.config.DatabaseConfig;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.ClassPathScanners;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Set;
@@ -14,10 +14,9 @@ import java.util.Set;
*/
public class BootupClassPathSearch {
private static final Logger logger = LoggerFactory.getLogger(BootupClassPathSearch.class);
private static final Logger log = CoreLog.internal;
private final List<String> packages;
private final List<ClassPathScanner> scanners;
/**
@@ -60,7 +59,7 @@ public class BootupClassPathSearch {
}
long searchTime = System.currentTimeMillis() - st;
logger.debug("Classpath search entities[{}] searchTime[{}] in packages[{}]", bc.getEntities().size(), searchTime, packages);
log.debug("Classpath search entities[{}] searchTime[{}] in packages[{}]", bc.getEntities().size(), searchTime, packages);
return bc;
} catch (Exception ex) {
@@ -5,21 +5,15 @@ import io.ebean.config.DatabaseConfig;
import io.ebean.config.IdGenerator;
import io.ebean.config.ScalarTypeConverter;
import io.ebean.core.type.ScalarType;
import io.ebean.event.BeanFindController;
import io.ebean.event.BeanPersistController;
import io.ebean.event.BeanPersistListener;
import io.ebean.event.BeanPostConstructListener;
import io.ebean.event.BeanPostLoad;
import io.ebean.event.BeanQueryAdapter;
import io.ebean.event.ServerConfigStartup;
import io.ebean.event.*;
import io.ebean.event.changelog.ChangeLogListener;
import io.ebean.event.changelog.ChangeLogPrepare;
import io.ebean.event.changelog.ChangeLogRegister;
import io.ebean.event.readaudit.ReadAuditLogger;
import io.ebean.event.readaudit.ReadAuditPrepare;
import io.ebean.util.AnnotationUtil;
import io.ebeaninternal.api.CoreLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.AttributeConverter;
import javax.persistence.Embeddable;
@@ -37,7 +31,7 @@ import java.util.function.Predicate;
*/
public class BootupClasses implements Predicate<Class<?>> {
private static final Logger logger = LoggerFactory.getLogger(BootupClasses.class);
private static final Logger log = CoreLog.internal;
private final List<Class<?>> embeddableList = new ArrayList<>();
private final List<Class<?>> entityList = new ArrayList<>();
@@ -211,13 +205,13 @@ public class BootupClasses implements Predicate<Class<?>> {
try {
return cls.getConstructor().newInstance();
} catch (NoSuchMethodException e) {
logger.debug("Ignore/expected - no default constructor: " +e.getMessage());
log.debug("Ignore/expected - no default constructor: " +e.getMessage());
return null;
} catch (Exception e) {
if (logOnException) {
// not expected but we log and carry on
logger.error("Error creating " + cls, e);
log.error("Error creating " + cls, e);
return null;
} else {
@@ -1,9 +1,9 @@
package io.ebeaninternal.server.core.bootup;
import io.ebean.util.StringHelper;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.util.UrlHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
@@ -20,10 +20,9 @@ import java.util.jar.Manifest;
*/
class ManifestReader {
private static final Logger logger = LoggerFactory.getLogger(ManifestReader.class);
private static final Logger log = CoreLog.internal;
private final Set<String> packageSet = new HashSet<>();
private final ClassLoader classLoader;
/**
@@ -65,7 +64,7 @@ class ManifestReader {
}
}
} catch (IOException e) {
logger.warn("Error reading " + resourcePath + " manifest resources", e);
log.warn("Error reading " + resourcePath + " manifest resources", e);
}
return packageSet;
}
@@ -1,16 +1,8 @@
package io.ebeaninternal.server.deploy;
import io.ebean.PersistenceContextScope;
import io.ebean.Query;
import io.ebean.SqlUpdate;
import io.ebean.Transaction;
import io.ebean.ValuePair;
import io.ebean.*;
import io.ebean.annotation.DocStoreMode;
import io.ebean.bean.BeanCollection;
import io.ebean.bean.EntityBean;
import io.ebean.bean.EntityBeanIntercept;
import io.ebean.bean.PersistenceContext;
import io.ebean.bean.SingleBeanLoader;
import io.ebean.bean.*;
import io.ebean.cache.QueryCacheEntry;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.EncryptKey;
@@ -18,12 +10,7 @@ import io.ebean.config.dbplatform.IdType;
import io.ebean.config.dbplatform.PlatformIdGenerator;
import io.ebean.core.type.DocPropertyType;
import io.ebean.core.type.ScalarType;
import io.ebean.event.BeanFindController;
import io.ebean.event.BeanPersistController;
import io.ebean.event.BeanPersistListener;
import io.ebean.event.BeanPostConstructListener;
import io.ebean.event.BeanPostLoad;
import io.ebean.event.BeanQueryAdapter;
import io.ebean.event.*;
import io.ebean.event.changelog.BeanChange;
import io.ebean.event.changelog.ChangeLogFilter;
import io.ebean.event.changelog.ChangeType;
@@ -45,32 +32,15 @@ import io.ebeaninternal.api.json.SpiJsonWriter;
import io.ebeaninternal.server.cache.CacheChangeSet;
import io.ebeaninternal.server.cache.CachedBeanData;
import io.ebeaninternal.server.cache.CachedManyIds;
import io.ebeaninternal.server.core.CacheOptions;
import io.ebeaninternal.server.core.DefaultSqlUpdate;
import io.ebeaninternal.server.core.InternString;
import io.ebeaninternal.server.core.PersistRequest;
import io.ebeaninternal.server.core.PersistRequestBean;
import io.ebeaninternal.server.core.*;
import io.ebeaninternal.server.deploy.id.IdBinder;
import io.ebeaninternal.server.deploy.id.IdBinderSimple;
import io.ebeaninternal.server.deploy.id.ImportedId;
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import io.ebeaninternal.server.deploy.meta.DeployBeanPropertyLists;
import io.ebeaninternal.server.el.ElComparator;
import io.ebeaninternal.server.el.ElComparatorCompound;
import io.ebeaninternal.server.el.ElComparatorNoop;
import io.ebeaninternal.server.el.ElComparatorProperty;
import io.ebeaninternal.server.el.ElPropertyChainBuilder;
import io.ebeaninternal.server.el.ElPropertyDeploy;
import io.ebeaninternal.server.el.ElPropertyValue;
import io.ebeaninternal.server.el.*;
import io.ebeaninternal.server.persist.DeleteMode;
import io.ebeaninternal.server.query.CQueryPlan;
import io.ebeaninternal.server.query.ExtraJoin;
import io.ebeaninternal.server.query.STreeProperty;
import io.ebeaninternal.server.query.STreePropertyAssoc;
import io.ebeaninternal.server.query.STreePropertyAssocMany;
import io.ebeaninternal.server.query.STreePropertyAssocOne;
import io.ebeaninternal.server.query.STreeType;
import io.ebeaninternal.server.query.SqlBeanLoad;
import io.ebeaninternal.server.query.*;
import io.ebeaninternal.server.querydefn.DefaultOrmQuery;
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
@@ -85,23 +55,14 @@ import io.ebeanservice.docstore.api.mapping.DocMappingBuilder;
import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
import io.ebeanservice.docstore.api.mapping.DocumentMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.persistence.PersistenceException;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.Modifier;
import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@@ -113,7 +74,7 @@ import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
*/
public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
private static final Logger logger = LoggerFactory.getLogger(BeanDescriptor.class);
private static final Logger log = CoreLog.internal;
public enum EntityType {
ORM, EMBEDDED, VIEW, SQL, DOC
@@ -511,8 +472,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* as they are used to get the imported and exported properties.
*/
void initialiseId(BeanDescriptorInitContext initContext) {
if (logger.isTraceEnabled()) {
logger.trace("BeanDescriptor initialise " + fullName);
if (log.isTraceEnabled()) {
log.trace("BeanDescriptor initialise " + fullName);
}
if (draftable) {
initContext.addDraft(baseTable, draftTable);
@@ -812,7 +773,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
changeJson.flush();
return beanChange(ChangeType.UPDATE, request.beanId(), changeJson.newJson(), changeJson.oldJson());
} catch (RuntimeException e) {
logger.error("Failed to write ChangeLog entry for update", e);
log.error("Failed to write ChangeLog entry for update", e);
return null;
}
}
@@ -828,7 +789,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
jsonWriter.flush();
return beanChange(ChangeType.INSERT, request.beanId(), writer.toString(), null);
} catch (IOException e) {
logger.error("Failed to write ChangeLog entry for insert", e);
log.error("Failed to write ChangeLog entry for insert", e);
return null;
}
}
@@ -1999,7 +1960,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Return the class type this BeanDescriptor describes.
*/
@Override
@Nonnull
public Class<T> type() {
return beanType;
}
@@ -2011,7 +1971,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* instead.
*/
@Override
@Nonnull
public String fullName() {
return fullName;
}
@@ -2020,7 +1979,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Return the short name of the entity bean.
*/
@Override
@Nonnull
public String name() {
return name;
}
@@ -2303,11 +2261,11 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
private ElComparator<T> createPropertyComparator(SortByClause.Property sortProp) {
ElPropertyValue elGetValue = elGetValue(sortProp.getName());
if (elGetValue == null) {
logger.error("Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
log.error("Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
return new ElComparatorNoop<>();
}
if (elGetValue.isAssocMany()) {
logger.error("Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
log.error("Sort property [" + sortProp + "] in " + beanType + " is a many-property. Cannot sort.");
return new ElComparatorNoop<>();
}
Boolean nullsHigh = sortProp.getNullsHigh();
@@ -2776,7 +2734,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
public void markAsDeleted(EntityBean bean) {
if (softDeleteProperty == null) {
Object id = getId(bean);
logger.info("(Lazy) loading unsuccessful for type:{} id:{} - expecting when bean has been deleted", name(), id);
log.info("(Lazy) loading unsuccessful for type:{} id:{} - expecting when bean has been deleted", name(), id);
bean._ebean_getIntercept().setLazyLoadFailure(id);
} else {
softDeleteValue(bean);
@@ -2875,8 +2833,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
final EntityBeanIntercept ebi = bean._ebean_getIntercept();
for (BeanPropertyAssocMany<?> many : propertiesManySave) {
if (ebi.isLoadedProperty(many.propertyIndex())) {
final BeanCollection<?> value = (BeanCollection<?>) many.getValue(bean);
if (value != null && value.hasModifications()) {
final Object value = many.getValue(bean);
if (value instanceof BeanCollection && ((BeanCollection<?>)value).hasModifications() || value != null) {
return true;
}
}
@@ -2974,7 +2932,6 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
}
@Override
@Nonnull
public Collection<? extends Property> allProperties() {
return propertiesAll();
}
@@ -6,17 +6,9 @@ import io.ebean.bean.EntityBeanIntercept;
import io.ebean.bean.PersistenceContext;
import io.ebean.cache.QueryCacheEntry;
import io.ebean.cache.ServerCache;
import io.ebeaninternal.api.BeanCacheResult;
import io.ebeaninternal.api.SpiCacheControl;
import io.ebeaninternal.api.SpiCacheRegion;
import io.ebeaninternal.api.SpiTransaction;
import io.ebeaninternal.api.*;
import io.ebeaninternal.api.TransactionEventTable.TableIUD;
import io.ebeaninternal.server.cache.CacheChangeSet;
import io.ebeaninternal.server.cache.CachedBeanData;
import io.ebeaninternal.server.cache.CachedBeanDataFromBean;
import io.ebeaninternal.server.cache.CachedBeanDataToBean;
import io.ebeaninternal.server.cache.CachedManyIds;
import io.ebeaninternal.server.cache.SpiCacheManager;
import io.ebeaninternal.server.cache.*;
import io.ebeaninternal.server.core.CacheOptions;
import io.ebeaninternal.server.core.PersistRequest;
import io.ebeaninternal.server.core.PersistRequestBean;
@@ -25,15 +17,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* Helper for BeanDescriptor that manages the bean, query and collection caches.
@@ -42,7 +26,7 @@ import java.util.Set;
*/
final class BeanDescriptorCacheHelp<T> {
private static final Logger logger = LoggerFactory.getLogger(BeanDescriptorCacheHelp.class);
private static final Logger log = CoreLog.internal;
private static final Logger queryLog = LoggerFactory.getLogger("io.ebean.cache.QUERY");
private static final Logger beanLog = LoggerFactory.getLogger("io.ebean.cache.BEAN");
@@ -120,10 +104,10 @@ final class BeanDescriptorCacheHelp<T> {
void deriveNotifyFlags() {
cacheNotifyOnAll = (invalidateQueryCache || beanCache != null || queryCache != null);
cacheNotifyOnDelete = !cacheNotifyOnAll && isNotifyOnDeletes();
if (logger.isDebugEnabled()) {
if (log.isDebugEnabled()) {
if (cacheNotifyOnAll || cacheNotifyOnDelete) {
String notifyMode = cacheNotifyOnAll ? "All" : "Delete";
logger.debug("l2 caching on {} - beanCaching:{} queryCaching:{} notifyMode:{} ",
log.debug("l2 caching on {} - beanCaching:{} queryCaching:{} notifyMode:{} ",
desc.fullName(), isBeanCaching(), isQueryCaching(), notifyMode);
}
}
@@ -324,7 +308,7 @@ final class BeanDescriptorCacheHelp<T> {
}
beanCache.put(parentId, newData);
} catch (IOException e) {
logger.error("Error updating L2 cache", e);
log.error("Error updating L2 cache", e);
}
}
} else {
@@ -365,12 +349,13 @@ final class BeanDescriptorCacheHelp<T> {
for (Object id : ids) {
keys.add(desc.cacheKey(id));
}
if (ids.isEmpty()) {
return new BeanCacheResult<>();
}
Map<Object, Object> beanDataMap = beanCache.getAll(keys);
if (beanLog.isTraceEnabled()) {
beanLog.trace(" MGET {}({}) - hits:{}", cacheName, ids, beanDataMap.keySet());
}
BeanCacheResult<T> result = new BeanCacheResult<>();
for (Map.Entry<Object, Object> entry : beanDataMap.entrySet()) {
CachedBeanData cachedBeanData = (CachedBeanData) entry.getValue();
@@ -90,7 +90,7 @@ final class BeanDescriptorJsonHelp<T> {
return null;
}
JsonParser newParser = node.traverse();
SpiJsonReader newReader = jsonRead.forJson(newParser, false);
SpiJsonReader newReader = jsonRead.forJson(newParser);
// check for the discriminator value to determine the correct sub type
String discColumn = inheritInfo.getRoot().getDiscriminatorColumn();
@@ -42,7 +42,6 @@ import io.ebeaninternal.xmapping.api.XmapRawSql;
import io.ebeanservice.docstore.api.DocStoreBeanAdapter;
import io.ebeanservice.docstore.api.DocStoreFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.MappedSuperclass;
import javax.persistence.PersistenceException;
@@ -59,7 +58,7 @@ import java.util.concurrent.TimeUnit;
*/
public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTypeManager {
private static final Logger logger = LoggerFactory.getLogger(BeanDescriptorManager.class);
private static final Logger log = CoreLog.internal;
private static final BeanDescComparator beanDescComparator = new BeanDescComparator();
public static final String JAVA_LANG_RECORD = "java.lang.Record";
@@ -310,7 +309,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
} catch (BeanNotEnhancedException e) {
throw e;
} catch (RuntimeException e) {
logger.error("Error in deployment", e);
log.error("Error in deployment", e);
throw e;
}
}
@@ -333,13 +332,13 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
try {
entityClass = Class.forName(entityClassName, false, classLoader);
} catch (Exception e) {
logger.error("Could not load entity bean class " + entityClassName + " for ebean.xml entry");
log.error("Could not load entity bean class " + entityClassName + " for ebean.xml entry");
return;
}
DeployBeanInfo<?> info = deployInfoMap.get(entityClass);
if (info == null) {
logger.error("No entity bean for ebean.xml entry " + entityClassName);
log.error("No entity bean for ebean.xml entry " + entityClassName);
} else {
for (XmapRawSql sql : entityDeploy.getRawSql()) {
@@ -350,10 +349,10 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
builder = RawSqlBuilder.unparsed(sql.getQuery());
}
for (Map.Entry<String,String> columnMapping : sql.getColumnMapping().entrySet()) {
for (Map.Entry<String, String> columnMapping : sql.getColumnMapping().entrySet()) {
builder.columnMapping(columnMapping.getKey(), columnMapping.getValue());
}
for (Map.Entry<String,String> aliasMapping : sql.getAliasMapping().entrySet()) {
for (Map.Entry<String, String> aliasMapping : sql.getAliasMapping().entrySet()) {
builder.tableAliasMapping(aliasMapping.getKey(), aliasMapping.getValue());
}
info.addRawSql(sql.getName(), builder.create());
@@ -411,7 +410,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
@Override
public boolean isTableManaged(String tableName) {
return tableToDescMap.get(tableName.toLowerCase()) != null
|| tableToViewDescMap.get(tableName.toLowerCase()) != null;
|| tableToViewDescMap.get(tableName.toLowerCase()) != null;
}
/**
@@ -580,11 +579,11 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
int pc = postConstructManager.getRegisterCount();
int lc = persistListenerManager.getRegisterCount();
int fc = beanFinderManager.getRegisterCount();
logger.debug("BeanPersistControllers[{}] BeanFinders[{}] BeanPersistListeners[{}] BeanQueryAdapters[{}] BeanPostLoaders[{}] BeanPostConstructors[{}]", cc, fc, lc, qa, pl, pc);
log.debug("BeanPersistControllers[{}] BeanFinders[{}] BeanPersistListeners[{}] BeanQueryAdapters[{}] BeanPostLoaders[{}] BeanPostConstructors[{}]", cc, fc, lc, qa, pl, pc);
}
private void logStatus() {
logger.debug("Entities[{}]", entityBeanCount);
log.debug("Entities[{}]", entityBeanCount);
}
/**
@@ -619,7 +618,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
DeployBeanInfo<?> info = createDeployBeanInfo(entityClass);
deployInfoMap.put(entityClass, info);
Class<?> embeddedIdType = info.getEmbeddedIdType();
if (embeddedIdType != null){
if (embeddedIdType != null) {
embeddedIdTypes.add(embeddedIdType);
}
}
@@ -789,8 +788,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
Class<?> targetType = prop.getTargetType();
DeployBeanInfo<?> info = deployInfoMap.get(targetType);
if (info == null) {
String msg = "Can not find descriptor [" + targetType + "] for " + prop.getFullBeanName();
throw new PersistenceException(msg);
throw new PersistenceException("Can not find descriptor [" + targetType + "] for " + prop.getFullBeanName());
}
return info.getDescriptor();
}
@@ -850,7 +848,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
String m = "Implicitly found mappedBy for " + targetDesc + "." + prop;
m += " by searching for [" + searchName + "] against " + matchSet;
logger.debug(m);
log.debug(m);
return true;
}
@@ -902,21 +900,17 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
Class<?> owningType = oneToMany.getOwningType();
if (!oneToMany.getCascadeInfo().isSave()) {
// The property MUST have persist cascading so that inserts work.
Class<?> targetType = oneToMany.getTargetType();
String msg = "Error on " + oneToMany.getFullBeanName() + ". @OneToMany MUST have ";
msg += "Cascade.PERSIST or Cascade.ALL because this is a unidirectional ";
msg += "relationship. That is, there is no property of type " + owningType + " on " + targetType;
throw new PersistenceException(msg);
}
// mark this property as unidirectional
oneToMany.setUnidirectional();
// specify table and table alias...
BeanTable beanTable = beanTable(owningType);
// define the TableJoin
DeployTableJoin oneToManyJoin = oneToMany.getTableJoin();
if (!oneToManyJoin.hasJoinColumns()) {
@@ -952,27 +946,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
String mappedBy = prop.getMappedBy();
// get the mappedBy property
DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
String m = "Error on " + prop.getFullBeanName();
m += " Can not find mappedBy property [" + targetDesc + "." + mappedBy + "] ";
throw new PersistenceException(m);
}
if (!(mappedProp instanceof DeployBeanPropertyAssocOne<?>)) {
String m = "Error on " + prop.getFullBeanName();
m += ". mappedBy property [" + targetDesc + "." + mappedBy + "]is not a OneToOne?";
throw new PersistenceException(m);
}
DeployBeanPropertyAssocOne<?> mappedAssocOne = (DeployBeanPropertyAssocOne<?>) mappedProp;
if (!mappedAssocOne.isOneToOne()) {
String m = "Error on " + prop.getFullBeanName();
m += ". mappedBy property [" + targetDesc + "." + mappedBy + "]is not a OneToOne?";
throw new PersistenceException(m);
}
DeployBeanPropertyAssocOne<?> mappedAssocOne = mappedOneToOne(prop, mappedBy, targetDesc);
DeployTableJoin tableJoin = prop.getTableJoin();
if (!tableJoin.hasJoinColumns()) {
// define Join as the inverse of the mappedBy property
@@ -988,6 +962,21 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
}
private DeployBeanPropertyAssocOne<?> mappedOneToOne(DeployBeanPropertyAssocOne<?> prop, String mappedBy, DeployBeanDescriptor<?> targetDesc) {
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property [" + targetDesc + "." + mappedBy + "]");
}
if (!(mappedProp instanceof DeployBeanPropertyAssocOne<?>)) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "]is not a OneToOne?");
}
DeployBeanPropertyAssocOne<?> mappedAssocOne = (DeployBeanPropertyAssocOne<?>) mappedProp;
if (!mappedAssocOne.isOneToOne()) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "]is not a OneToOne?");
}
return mappedAssocOne;
}
private void checkUniDirectionalPrimaryKeyJoin(DeployBeanPropertyAssocOne<?> prop) {
if (prop.isPrimaryKeyJoin()) {
// uni-directional PrimaryKeyJoin ...
@@ -1009,7 +998,6 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
return;
}
DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);
if (targetDesc.isDraftableElement()) {
// automatically turning on orphan removal and CascadeType.ALL
prop.setModifyListenMode(BeanCollection.ModifyListenMode.REMOVALS);
@@ -1041,23 +1029,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
String mappedBy = prop.getMappedBy();
// get the mappedBy property
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
String m = "Error on " + prop.getFullBeanName();
m += " Can not find mappedBy property [" + mappedBy + "] ";
m += "in [" + targetDesc + "]";
throw new PersistenceException(m);
}
if (!(mappedProp instanceof DeployBeanPropertyAssocOne<?>)) {
String m = "Error on " + prop.getFullBeanName();
m += ". mappedBy property [" + mappedBy + "]is not a ManyToOne?";
m += "in [" + targetDesc + "]";
throw new PersistenceException(m);
}
DeployBeanPropertyAssocOne<?> mappedAssocOne = (DeployBeanPropertyAssocOne<?>) mappedProp;
DeployBeanPropertyAssocOne<?> mappedAssocOne = mappedManyToOne(prop, targetDesc, mappedBy);
DeployTableJoin tableJoin = prop.getTableJoin();
if (!tableJoin.hasJoinColumns()) {
// define Join as the inverse of the mappedBy property
@@ -1080,6 +1052,17 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
}
private DeployBeanPropertyAssocOne<?> mappedManyToOne(DeployBeanPropertyAssocMany<?> prop, DeployBeanDescriptor<?> targetDesc, String mappedBy) {
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property [" + mappedBy + "] " + "in [" + targetDesc + "]");
}
if (!(mappedProp instanceof DeployBeanPropertyAssocOne<?>)) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + mappedBy + "]is not a ManyToOne?" + "in [" + targetDesc + "]");
}
return (DeployBeanPropertyAssocOne<?>) mappedProp;
}
/**
* For mappedBy copy the joins from the other side.
*/
@@ -1095,33 +1078,10 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
// get the mappedBy property
DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
String m = "Error on " + prop.getFullBeanName();
m += " Can not find mappedBy property [" + mappedBy + "] ";
m += "in [" + targetDesc + "]";
throw new PersistenceException(m);
}
if (!(mappedProp instanceof DeployBeanPropertyAssocMany<?>)) {
String m = "Error on " + prop.getFullBeanName();
m += ". mappedBy property [" + targetDesc + "." + mappedBy + "] is not a ManyToMany?";
throw new PersistenceException(m);
}
DeployBeanPropertyAssocMany<?> mappedAssocMany = (DeployBeanPropertyAssocMany<?>) mappedProp;
if (!mappedAssocMany.isManyToMany()) {
String m = "Error on " + prop.getFullBeanName();
m += ". mappedBy property [" + targetDesc + "." + mappedBy + "] is not a ManyToMany?";
throw new PersistenceException(m);
}
DeployBeanPropertyAssocMany<?> mappedAssocMany = mappedManyToMany(prop, mappedBy, targetDesc);
// define the relationships/joins on this side as the
// reverse of the other mappedBy side ...
// DeployTableJoin mappedJoin = mappedAssocMany.getTableJoin();
DeployTableJoin mappedIntJoin = mappedAssocMany.getIntersectionJoin();
DeployTableJoin mappendInverseJoin = mappedAssocMany.getInverseJoin();
@@ -1143,6 +1103,22 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
}
private DeployBeanPropertyAssocMany<?> mappedManyToMany(DeployBeanPropertyAssocMany<?> prop, String mappedBy, DeployBeanDescriptor<?> targetDesc) {
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property [" + mappedBy + "] " + "in [" + targetDesc + "]");
}
if (!(mappedProp instanceof DeployBeanPropertyAssocMany<?>)) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "] is not a ManyToMany?");
}
DeployBeanPropertyAssocMany<?> mappedAssocMany = (DeployBeanPropertyAssocMany<?>) mappedProp;
if (!mappedAssocMany.isManyToMany()) {
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "] is not a ManyToMany?");
}
return mappedAssocMany;
}
private <T> void setBeanControllerFinderListener(DeployBeanDescriptor<T> descriptor) {
persistControllerManager.addPersistControllers(descriptor);
postLoadManager.addPostLoad(descriptor);
@@ -1209,12 +1185,12 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
final DeployIdentityMode identityMode = desc.getIdentityMode();
if (identityMode.isSequence() && !dbIdentity.isSupportsSequence()) {
// explicit sequence but not supported by the DatabasePlatform
logger.info("Explicit sequence on " + desc.getFullName() + " but not supported by DB Platform - ignored");
log.info("Explicit sequence on " + desc.getFullName() + " but not supported by DB Platform - ignored");
identityMode.setIdType(IdType.AUTO);
}
if (identityMode.isIdentity() && !dbIdentity.isSupportsIdentity()) {
// explicit identity but not supported by the DatabasePlatform
logger.info("Explicit Identity on " + desc.getFullName() + " but not supported by DB Platform - ignored");
log.info("Explicit Identity on " + desc.getFullName() + " but not supported by DB Platform - ignored");
identityMode.setIdType(IdType.AUTO);
}
@@ -1,10 +1,10 @@
package io.ebeaninternal.server.deploy;
import io.ebean.event.BeanFindController;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -13,7 +13,7 @@ import java.util.List;
*/
final class BeanFinderManager {
private final Logger logger = LoggerFactory.getLogger(BeanFinderManager.class);
private static final Logger log = CoreLog.internal;
private final List<BeanFindController> list;
@@ -31,7 +31,7 @@ final class BeanFinderManager {
void addFindControllers(DeployBeanDescriptor<?> deployDesc) {
for (BeanFindController c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanFindController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
log.debug("BeanFindController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.setBeanFinder(c);
}
}
@@ -15,6 +15,7 @@ import io.ebean.core.type.ScalarType;
import io.ebean.plugin.Property;
import io.ebean.text.StringParser;
import io.ebean.util.SplitName;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.api.SpiExpressionRequest;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.api.json.SpiJsonReader;
@@ -38,10 +39,7 @@ import io.ebeanservice.docstore.api.mapping.DocMappingBuilder;
import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
import io.ebeanservice.docstore.api.mapping.DocPropertyOptions;
import io.ebeanservice.docstore.api.support.DocStructure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.persistence.PersistenceException;
import java.io.DataInput;
import java.io.DataOutput;
@@ -59,8 +57,6 @@ import java.util.Set;
*/
public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
private static final Logger logger = LoggerFactory.getLogger(BeanProperty.class);
private static final String ENC_PREFIX = " " + EncryptAlias.PREFIX;
/**
@@ -816,7 +812,6 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
* Return the name of the property.
*/
@Override
@Nonnull
public String name() {
return name;
}
@@ -1302,7 +1297,6 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
* Return the property type.
*/
@Override
@Nonnull
public Class<?> type() {
return propertyType;
}
@@ -1412,7 +1406,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
objValue = null;
String msg = "Error trying to use Jackson ObjectMapper to read transient property "
+ fullName() + " - consider marking this property with @JsonIgnore";
logger.error(msg, e);
CoreLog.log.error(msg, e);
}
}
if (jsonDeserialize) {
@@ -5,6 +5,7 @@ import io.ebean.bean.EntityBean;
import io.ebean.core.type.DocPropertyType;
import io.ebean.text.PathProperties;
import io.ebean.util.SplitName;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.server.core.DefaultSqlUpdate;
@@ -24,8 +25,6 @@ import io.ebeaninternal.server.querydefn.DefaultOrmQuery;
import io.ebeanservice.docstore.api.mapping.DocMappingBuilder;
import io.ebeanservice.docstore.api.mapping.DocPropertyMapping;
import io.ebeanservice.docstore.api.support.DocStructure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.PersistenceException;
import java.util.ArrayList;
@@ -36,8 +35,6 @@ import java.util.List;
*/
public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STreePropertyAssoc {
private static final Logger logger = LoggerFactory.getLogger(BeanPropertyAssoc.class);
/**
* The descriptor of the target. This MUST be initialised after construction
* so as to avoid a dependency loop between BeanDescriptors.
@@ -435,8 +432,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
if (!idProp.isEmbedded()) {
// simple single scalar id
if (cols.length != 1) {
String msg = "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]";
logger.error(msg);
CoreLog.log.error("No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]");
return null;
} else {
BeanProperty[] idProps = {idProp};
@@ -11,10 +11,7 @@ import io.ebean.bean.EntityBean;
import io.ebean.bean.PersistenceContext;
import io.ebean.plugin.PropertyAssocMany;
import io.ebean.text.PathProperties;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiExpressionRequest;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.api.SpiSqlUpdate;
import io.ebeaninternal.api.*;
import io.ebeaninternal.api.json.SpiJsonReader;
import io.ebeaninternal.api.json.SpiJsonWriter;
import io.ebeaninternal.server.deploy.id.ImportedId;
@@ -23,25 +20,17 @@ import io.ebeaninternal.server.el.ElPropertyChainBuilder;
import io.ebeaninternal.server.el.ElPropertyValue;
import io.ebeaninternal.server.query.STreePropertyAssocMany;
import io.ebeaninternal.server.query.SqlBeanLoad;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.PersistenceException;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* Property mapped to a List Set or Map.
*/
public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements STreePropertyAssocMany, PropertyAssocMany {
private static final Logger logger = LoggerFactory.getLogger(BeanPropertyAssocMany.class);
private final BeanPropertyAssocManyJsonHelp jsonHelp;
/**
* Join for manyToMany intersection table.
@@ -664,7 +653,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
}
} catch (PersistenceException e) {
// not found as individual scalar properties
logger.error("Could not find a exported property?", e);
CoreLog.log.error("Could not find a exported property?", e);
}
} else {
if (idProp != null) {
@@ -959,7 +948,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
setValue(bean, collection);
}
} catch (Exception e) {
logger.error("Error setting value from L2 cache", e);
CoreLog.log.error("Error setting value from L2 cache", e);
}
}
@@ -972,7 +961,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
}
return jsonWriteCollection(collection);
} catch (Exception e) {
logger.error("Error building value element collection json for L2 cache", e);
CoreLog.log.error("Error building value element collection json for L2 cache", e);
return null;
}
}
@@ -1,10 +1,9 @@
package io.ebeaninternal.server.deploy;
import io.ebean.event.BeanQueryAdapter;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -13,8 +12,6 @@ import java.util.List;
*/
final class BeanQueryAdapterManager {
private static final Logger logger = LoggerFactory.getLogger(BeanQueryAdapterManager.class);
private final List<BeanQueryAdapter> list;
BeanQueryAdapterManager(BootupClasses bootupClasses) {
@@ -31,7 +28,7 @@ final class BeanQueryAdapterManager {
void addQueryAdapter(DeployBeanDescriptor<?> deployDesc) {
for (BeanQueryAdapter c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanQueryAdapter on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
CoreLog.internal.debug("BeanQueryAdapter on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addQueryAdapter(c);
}
}
@@ -1,11 +1,10 @@
package io.ebeaninternal.server.deploy;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.InternString;
import io.ebeaninternal.server.deploy.meta.DeployBeanTable;
import io.ebeaninternal.server.deploy.meta.DeployTableJoin;
import io.ebeaninternal.server.deploy.meta.DeployTableJoinColumn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
@@ -19,8 +18,6 @@ import org.slf4j.LoggerFactory;
*/
public final class BeanTable {
private static final Logger logger = LoggerFactory.getLogger(BeanTable.class);
private final BeanDescriptorMap owner;
private final Class<?> beanType;
private final String baseTable;
@@ -108,7 +105,7 @@ public final class BeanTable {
if (complexKey) {
// just to copy the column name rather than prefix with the foreignKeyPrefix.
// I think that with complex keys this is the more common approach.
logger.debug("On table[{}] foreign key column [{}]", baseTable, lc);
CoreLog.internal.debug("On table[{}] foreign key column [{}]", baseTable, lc);
fk = lc;
}
if (sqlFormulaSelect != null) {
@@ -1,10 +1,9 @@
package io.ebeaninternal.server.deploy;
import io.ebean.event.BeanPersistController;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -13,8 +12,6 @@ import java.util.List;
*/
final class PersistControllerManager {
private static final Logger logger = LoggerFactory.getLogger(PersistControllerManager.class);
private final List<BeanPersistController> list;
PersistControllerManager(BootupClasses bootupClasses) {
@@ -31,7 +28,7 @@ final class PersistControllerManager {
void addPersistControllers(DeployBeanDescriptor<?> deployDesc) {
for (BeanPersistController c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPersistController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
CoreLog.log.debug("BeanPersistController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addPersistController(c);
}
}
@@ -1,10 +1,9 @@
package io.ebeaninternal.server.deploy;
import io.ebean.event.BeanPersistListener;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -14,8 +13,6 @@ import java.util.List;
*/
final class PersistListenerManager {
private static final Logger logger = LoggerFactory.getLogger(PersistListenerManager.class);
private final List<BeanPersistListener> list;
PersistListenerManager(BootupClasses bootupClasses) {
@@ -32,7 +29,7 @@ final class PersistListenerManager {
<T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
for (BeanPersistListener listener : list) {
if (listener.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
CoreLog.log.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
deployDesc.addPersistListener(listener);
}
}
@@ -1,10 +1,9 @@
package io.ebeaninternal.server.deploy;
import io.ebean.event.BeanPostConstructListener;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -13,8 +12,6 @@ import java.util.List;
*/
final class PostConstructManager {
private static final Logger logger = LoggerFactory.getLogger(PostConstructManager.class);
private final List<BeanPostConstructListener> list;
PostConstructManager(BootupClasses bootupClasses) {
@@ -31,7 +28,7 @@ final class PostConstructManager {
void addPostConstructListeners(DeployBeanDescriptor<?> deployDesc) {
for (BeanPostConstructListener c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
CoreLog.log.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addPostConstructListener(c);
}
}
@@ -1,10 +1,9 @@
package io.ebeaninternal.server.deploy;
import io.ebean.event.BeanPostLoad;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -13,8 +12,6 @@ import java.util.List;
*/
final class PostLoadManager {
private static final Logger logger = LoggerFactory.getLogger(PostLoadManager.class);
private final List<BeanPostLoad> list;
PostLoadManager(BootupClasses bootupClasses) {
@@ -31,7 +28,7 @@ final class PostLoadManager {
void addPostLoad(DeployBeanDescriptor<?> deployDesc) {
for (BeanPostLoad c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
CoreLog.log.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addPostLoad(c);
}
}
@@ -36,7 +36,7 @@ public final class IdBinderSimple implements IdBinder {
this.idProperty = idProperty;
this.scalarType = idProperty.scalarType();
this.expectedType = idProperty.type();
bindIdSql = InternString.intern(idProperty.dbColumn() + " = ? ");
bindIdSql = InternString.intern(idProperty.dbColumn() + " = ?");
this.multiValueBind = multiValueBind;
}
@@ -1,12 +1,11 @@
package io.ebeaninternal.server.deploy.meta;
import io.ebean.bean.EntityBean;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.server.deploy.*;
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedProperty;
import io.ebeaninternal.server.properties.BeanPropertySetter;
import io.ebeaninternal.server.type.ScalarTypeString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -17,8 +16,6 @@ import java.util.List;
*/
public final class DeployBeanPropertyLists {
private static final Logger logger = LoggerFactory.getLogger(DeployBeanPropertyLists.class);
private static final NoopSetter NOOP_SETTER = new NoopSetter();
private BeanProperty versionProperty;
@@ -225,7 +222,7 @@ public final class DeployBeanPropertyLists {
if (versionProperty == null) {
versionProperty = prop;
} else {
logger.warn("Multiple @Version properties - property " + prop.fullName() + " not treated as a version property");
CoreLog.internal.warn("Multiple @Version properties - property " + prop.fullName() + " not treated as a version property");
}
} else if (prop.isDraftDirty()) {
draftDirty = prop;

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