diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..837d975fa
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+spaces_around_operators = true
diff --git a/pom.xml b/pom.xml
index 485139656..273173ad5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
- * Typically this would be used to set the loaded state of a property - * to false to ensure that the specific property is excluded from a - * stateless update. + * Typically this would be used to set the loaded state of a property + * to false to ensure that the specific property is excluded from a + * stateless update. *
- * *{@code
*
* // populate a bean via say JSON
@@ -64,8 +62,7 @@ public interface BeanState {
* user.update();
*
* }
- *
- *
+ *
* This will throw an IllegalArgumentException if the property is unknown.
*/
void setPropertyLoaded(String propertyName, boolean loaded);
@@ -87,8 +84,8 @@ public interface BeanState {
/**
* Return a map of the updated properties and their new and old values.
*/
- Map
@@ -125,4 +122,4 @@ public interface BeanState {
* Reset the bean putting it into NEW state such that a save() results in an insert.
*/
void resetForInsert();
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/CallableSql.java b/src/main/java/com/avaje/ebean/CallableSql.java
index fcff6b43b..edeb670a0 100644
--- a/src/main/java/com/avaje/ebean/CallableSql.java
+++ b/src/main/java/com/avaje/ebean/CallableSql.java
@@ -13,65 +13,66 @@ import java.sql.SQLException;
*
* Example 1:
*
* Example 2:
- * String sql = "{call sp_order_mod(?,?)}";
- *
+ *
* {@code
+ *
+ * String sql = "{call sp_order_mod(?,?)}";
+ *
* CallableSql cs = Ebean.createCallableSql(sql);
- * cs.setParameter(1, "turbo");
+ * cs.setParameter(1, "turbo");
* cs.registerOut(2, Types.INTEGER);
- *
+ *
* Ebean.execute(cs);
- *
+ *
* // read the out parameter
* Integer returnValue = (Integer) cs.getObject(2);
- *
- *
+ *
+ * }
* Includes batch mode, table modification information and label. Note that the
* label is really only to help people reading the transaction logs to identify
* the procedure called etc.
*
- * String sql = "{call sp_insert_order(?,?)}";
- *
+ *
+ *
+ *
* @see com.avaje.ebean.SqlUpdate
* @see com.avaje.ebean.Ebean#execute(CallableSql)
*/
@@ -119,21 +120,17 @@ public interface CallableSql {
* This is designed so that you do not need to set params in index order. You
* can set/register param 2 before param 1 etc.
* {@code
+ *
+ * String sql = "{call sp_insert_order(?,?)}";
+ *
* CallableSql cs = Ebean.createCallableSql(sql);
- *
+ *
* // Inform Ebean this stored procedure inserts into the
* // oe_order table and inserts + updates the oe_order_detail table.
* // this is used to invalidate objects in the cache
- * cs.addModification("oe_order", true, false, false);
- * cs.addModification("oe_order_detail", true, true, false);
- *
+ * cs.addModification("oe_order", true, false, false);
+ * cs.addModification("oe_order_detail", true, true, false);
+ *
* Transaction t = Ebean.startTransaction();
- *
+ *
* // execute using JDBC batching 10 statements at a time
* t.setBatchMode(true);
* t.setBatchSize(10);
* try {
- * cs.setParameter(1, "Was");
- * cs.setParameter(2, "Banana");
+ * cs.setParameter(1, "Was");
+ * cs.setParameter(2, "Banana");
* Ebean.execute(cs);
- *
- * cs.setParameter(1, "Here");
- * cs.setParameter(2, "Kumera");
+ *
+ * cs.setParameter(1, "Here");
+ * cs.setParameter(2, "Kumera");
* Ebean.execute(cs);
- *
- * cs.setParameter(1, "More");
- * cs.setParameter(2, "Apple");
+ *
+ * cs.setParameter(1, "More");
+ * cs.setParameter(2, "Apple");
* Ebean.execute(cs);
- *
- * // Ebean.externalModification("oe_order",true,false,false);
- * // Ebean.externalModification("oe_order_detail",true,true,false);
+ *
+ * // Ebean.externalModification("oe_order",true,false,false);
+ * // Ebean.externalModification("oe_order_detail",true,true,false);
* Ebean.commitTransaction();
- *
+ *
* } finally {
* Ebean.endTransaction();
* }
- *
- *
+ * }
* Typically this is called indirectly by findPagedList() on the query that has setUseDocStore(true). *
- * *{@code
*
* PagedList newCustomers =
@@ -104,7 +103,6 @@ public interface DocumentStore {
* .findPagedList();
*
* }
- *
*/
* Typically this is called indirectly by findEach() on the query that has setUseDocStore(true). *
- * *{@code
*
* server.find(Order.class)
@@ -146,8 +143,6 @@ public interface DocumentStore {
*
* Typically this is called indirectly by findEachWhile() on the query that has setUseDocStore(true).
*
- *
- *
* {@code
*
* server.find(Order.class)
@@ -175,7 +170,6 @@ public interface DocumentStore {
/**
* Drop the index from the document store (similar to DDL drop table).
- *
* {@code
*
* DocumentStore documentStore = server.docStore();
@@ -183,13 +177,11 @@ public interface DocumentStore {
* documentStore.dropIndex("product_copy");
*
* }
- *
*/
void dropIndex(String indexName);
/**
* Create an index given a mapping file as a resource in the classPath (similar to DDL create table).
- *
* {@code
*
* DocumentStore documentStore = server.docStore();
@@ -201,8 +193,8 @@ public interface DocumentStore {
*
* }
*
- * @param indexName the name of the new index
- * @param alias the alias of the index
+ * @param indexName the name of the new index
+ * @param alias the alias of the index
*/
void createIndex(String indexName, String alias);
@@ -222,7 +214,6 @@ public interface DocumentStore {
* documentStore.indexSettings("product", settings);
*
* }
- *
* {@code
*
* // refresh_interval 1s ... restore after bulk loading
@@ -244,7 +235,6 @@ public interface DocumentStore {
*
* This copy process does not use the database but instead will copy from the source index to a destination index.
*
- *
* {@code
*
* long copyCount = documentStore.copyIndex(Product.class, "product_copy");
@@ -263,7 +253,6 @@ public interface DocumentStore {
*
* To support this the document needs to have a @WhenModified property.
*
- *
* {@code
*
* long copyCount = documentStore.copyIndex(Product.class, "product_copy", sinceMillis);
@@ -279,7 +268,6 @@ public interface DocumentStore {
/**
* Copy from a source index to a new index taking only the documents
* matching the given query.
- *
* {@code
*
* // predicates to select the source documents to copy
diff --git a/src/main/java/com/avaje/ebean/Ebean.java b/src/main/java/com/avaje/ebean/Ebean.java
index ffd330b1a..e7012913e 100644
--- a/src/main/java/com/avaje/ebean/Ebean.java
+++ b/src/main/java/com/avaje/ebean/Ebean.java
@@ -41,7 +41,6 @@ import java.util.concurrent.ConcurrentHashMap;
* {@link #find(Class)} that proxy through to the 'default' EbeanServer. This
* can be useful for applications that use a single database.
*
- *
*
* For developer convenience Ebean has static methods that proxy through to the
* methods on the 'default' EbeanServer. These methods are provided for
@@ -59,7 +58,6 @@ import java.util.concurrent.ConcurrentHashMap;
* created automatically they are configured using information in the
* ebean.properties file.
*
- *
* {@code
*
* // fetch shipped orders (and also their customer)
@@ -76,40 +74,36 @@ import java.util.concurrent.ConcurrentHashMap;
* }
*
* }
- *
* {@code
*
* // fetch order 10, modify and save
* Order order = Ebean.find(Order.class, 10);
- *
+ *
* OrderStatus shipped = Ebean.getReference(OrderStatus.class,"SHIPPED");
* order.setStatus(shipped);
* order.setShippedDate(shippedDate);
* ...
- *
+ *
* // implicitly creates a transaction and commits
* Ebean.save(order);
*
* }
- *
*
* When you have multiple databases and need access to a specific one the
* {@link #getServer(String)} method provides access to the EbeanServer for that
* specific database.
*
- *
* {@code
*
* // Get access to the Human Resources EbeanServer/Database
* EbeanServer hrDb = Ebean.getServer("hr");
- *
- *
+ *
* // fetch contact 3 from the HR database
* Contact contact = hrDb.find(Contact.class, 3);
- *
+ *
* contact.setName("I'm going to change");
* ...
- *
+ *
* // save the contact back to the HR database
* hrDb.save(contact);
*
@@ -132,13 +126,13 @@ public final class Ebean {
/**
* Cache for fast concurrent read access.
*/
- private final ConcurrentHashMap concMap = new ConcurrentHashMap();
+ private final ConcurrentHashMap concMap = new ConcurrentHashMap<>();
/**
* Cache for synchronized read, creation and put. Protected by the monitor
* object.
*/
- private final HashMap syncMap = new HashMap();
+ private final HashMap syncMap = new HashMap<>();
private final Object monitor = new Object();
@@ -217,7 +211,7 @@ public final class Ebean {
private void register(EbeanServer server, boolean isDefaultServer) {
registerWithName(server.getName(), server, isDefaultServer);
}
-
+
private void registerWithName(String name, EbeanServer server, boolean isDefaultServer) {
synchronized (monitor) {
concMap.put(name, server);
@@ -242,16 +236,14 @@ public final class Ebean {
* transactions and the ability to use transactions created externally to
* Ebean.
*
- *
* {@code
* // use the "hr" database
* EbeanServer hrDatabase = Ebean.getServer("hr");
- *
+ *
* Person person = hrDatabase.find(Person.class, 10);
* }
- *
- * @param name
- * the name of the server, can use null for the 'default server'
+ *
+ * @param name the name of the server, can use null for the 'default server'
*/
public static EbeanServer getServer(String name) {
return serverMgr.get(name);
@@ -304,7 +296,7 @@ public final class Ebean {
serverMgr.registerWithName(name, server, defaultServer);
return originalPrimaryServer;
}
-
+
/**
* Return the next identity value for a given bean type.
*
@@ -336,7 +328,6 @@ public final class Ebean {
* Example of using a transaction to span multiple calls to find(), save()
* etc.
*
- *
* {@code
*
* // start a transaction (stored in a ThreadLocal)
@@ -345,9 +336,9 @@ public final class Ebean {
* Order order = Ebean.find(Order.class,10); ...
*
* Ebean.save(order);
- *
+ *
* Ebean.commitTransaction();
- *
+ *
* } finally {
* // rollback if we didn't commit
* // i.e. an exception occurred before commitTransaction().
@@ -355,7 +346,6 @@ public final class Ebean {
* }
*
* }
- *
*
* If you want to externalise the transaction management then you should be
* able to do this via EbeanServer. Specifically with EbeanServer you can pass
@@ -371,10 +361,8 @@ public final class Ebean {
/**
* Start a transaction additionally specifying the isolation level.
- *
- * @param isolation
- * the Transaction isolation level
- *
+ *
+ * @param isolation the Transaction isolation level
*/
public static Transaction beginTransaction(TxIsolation isolation) {
return serverMgr.getDefaultServer().beginTransaction(isolation);
@@ -382,12 +370,10 @@ public final class Ebean {
/**
* Start a transaction typically specifying REQUIRES_NEW or REQUIRED semantics.
- *
*
* Note that this provides an try finally alternative to using {@link #execute(TxScope, TxCallable)} or
* {@link #execute(TxScope, TxRunnable)}.
*
- *
* REQUIRES_NEW example:
* {@code
* // Start a new transaction. If there is a current transaction
@@ -408,7 +394,6 @@ public final class Ebean {
* }
*
* }
- *
* REQUIRED example:
* {@code
*
@@ -431,7 +416,7 @@ public final class Ebean {
*
* }
*/
- public static Transaction beginTransaction(TxScope scope){
+ public static Transaction beginTransaction(TxScope scope) {
return serverMgr.getDefaultServer().beginTransaction(scope);
}
@@ -449,7 +434,6 @@ public final class Ebean {
* If there is no currently active transaction then a PersistenceException is thrown.
*
* @param transactionCallback the transaction callback to be registered with the current transaction
- *
* @throws PersistenceException if there is no currently active transaction
*/
public static void register(TransactionCallback transactionCallback) throws PersistenceException {
@@ -480,7 +464,6 @@ public final class Ebean {
*
* Code example:
*
- *
* {@code
* Ebean.beginTransaction();
* try {
@@ -488,7 +471,7 @@ public final class Ebean {
*
* // commit at the end
* Ebean.commitTransaction();
- *
+ *
* } finally {
* // if commit didn't occur then rollback the transaction
* Ebean.endTransaction();
@@ -532,16 +515,14 @@ public final class Ebean {
* In this example below the details property has a CascadeType.ALL set so
* saving an order will also save all its details.
*
- *
* {@code
* public class Order { ...
- *
+ *
* @OneToMany(cascade=CascadeType.ALL, mappedBy="order")
* List details;
* ...
* }
* }
- *
*
* When a save cascades via a OneToMany or ManyToMany Ebean will automatically
* set the 'parent' object to the 'detail' object. In the example below in
@@ -576,16 +557,15 @@ public final class Ebean {
*
* An unmodified bean that is saved or updated is normally skipped and this marks the bean as
* dirty so that it is not skipped.
- *
*
{@code
- *
+ *
* Customer customer = Ebean.find(Customer, id);
- *
+ *
* // mark the bean as dirty so that a save() or update() will
* // increment the version property
* Ebean.markAsDirty(customer);
* Ebean.save(customer);
- *
+ *
* }
*/
public static void markAsDirty(Object bean) throws OptimisticLockException {
@@ -614,17 +594,16 @@ public final class Ebean {
* controls if only the changed properties are included in the update or if all the loaded
* properties are included instead.
*
- *
* {@code
- *
+ *
* // A 'stateless update' example
* Customer customer = new Customer();
* customer.setId(7);
* customer.setName("ModifiedNameNoOCC");
* ebeanServer.update(customer);
- *
+ *
* }
- *
+ *
* @see ServerConfig#setUpdatesDeleteMissingChildren(boolean)
* @see ServerConfig#setUpdateChangesOnly(boolean)
*/
@@ -731,7 +710,6 @@ public final class Ebean {
/**
* Refresh a 'many' property of a bean.
- *
* {@code
*
* Order order = ...;
@@ -740,11 +718,9 @@ public final class Ebean {
* Ebean.refreshMany(order, "details");
*
* }
- *
- * @param bean
- * the entity bean containing the List Set or Map to refresh.
- * @param manyPropertyName
- * the property name of the List Set or Map to refresh.
+ *
+ * @param bean the entity bean containing the List Set or Map to refresh.
+ * @param manyPropertyName the property name of the List Set or Map to refresh.
*/
public static void refreshMany(Object bean, String manyPropertyName) {
serverMgr.getDefaultServer().refreshMany(bean, manyPropertyName);
@@ -755,24 +731,21 @@ public final class Ebean {
*
* This is sometimes described as a proxy (with lazy loading).
*
- *
* {@code
*
* Product product = Ebean.getReference(Product.class, 1);
- *
+ *
* // You can get the id without causing a fetch/lazy load
* Integer productId = product.getId();
- *
+ *
* // If you try to get any other property a fetch/lazy loading will occur
* // This will cause a query to execute...
* String name = product.getName();
*
* }
- *
- * @param beanType
- * the type of entity bean
- * @param id
- * the id value
+ *
+ * @param beanType the type of entity bean
+ * @param id the id value
*/
public static T getReference(Class beanType, Object id) {
return serverMgr.getDefaultServer().getReference(beanType, id);
@@ -796,29 +769,26 @@ public final class Ebean {
* Note that the sorting uses a Comparator and Collections.sort(); and does
* not invoke a DB query.
*
- *
* {@code
- *
+ *
* // find orders and their customers
* List list = Ebean.find(Order.class)
* .fetch("customer")
* .orderBy("id")
* .findList();
- *
+ *
* // sort by customer name ascending, then by order shipDate
* // ... then by the order status descending
* Ebean.sort(list, "customer.name, shipDate, status desc");
- *
+ *
* // sort by customer name descending (with nulls low)
* // ... then by the order id
* Ebean.sort(list, "customer.name desc nullsLow, id");
- *
+ *
* }
- *
- * @param list
- * the list of entity beans
- * @param sortByClause
- * the properties to sort the list by
+ *
+ * @param list the list of entity beans
+ * @param sortByClause the properties to sort the list by
*/
public static void sort(List list, String sortByClause) {
serverMgr.getDefaultServer().sort(list, sortByClause);
@@ -826,35 +796,35 @@ public final class Ebean {
/**
* Find a bean using its unique id. This will not use caching.
- *
* {@code
+ *
* // Fetch order 1
* Order order = Ebean.find(Order.class, 1);
+ *
* }
- *
*
* If you want more control over the query then you can use createQuery() and
* Query.findUnique();
*
- *
* {@code
+ *
* // ... additionally fetching customer, customer shipping address,
* // order details, and the product associated with each order detail.
* // note: only product id and name is fetch (its a "partial object").
* // note: all other objects use "*" and have all their properties fetched.
- *
+ *
* Query query = Ebean.find(Order.class)
* .setId(1)
* .fetch("customer")
* .fetch("customer.shippingAddress")
* .fetch("details")
* .query();
- *
+ *
* // fetch associated products but only fetch their product id and name
* query.fetch("details.product", "name");
- *
+ *
* // traverse the object graph...
- *
+ *
* Order order = query.findUnique();
* Customer customer = order.getCustomer();
* Address shippingAddress = customer.getShippingAddress();
@@ -864,11 +834,9 @@ public final class Ebean {
* String productName = product.getName();
*
* }
- *
- * @param beanType
- * the type of entity bean to fetch
- * @param id
- * the id value
+ *
+ * @param beanType the type of entity bean to fetch
+ * @param id the id value
*/
@Nullable
public static T find(Class beanType, Object id) {
@@ -903,7 +871,7 @@ public final class Ebean {
/**
* Create a CallableSql to execute a given stored procedure.
- *
+ *
* @see CallableSql
*/
public static CallableSql createCallableSql(String sql) {
@@ -921,19 +889,18 @@ public final class Ebean {
*
* An example:
*
- *
* {@code
- *
+ *
* // The bean name and properties - "topic","postCount" and "id"
- *
+ *
* // will be converted into their associated table and column names
* String updStatement = "update topic set postCount = :pc where id = :id";
- *
+ *
* Update update = Ebean.createUpdate(Topic.class, updStatement);
- *
+ *
* update.set("pc", 9);
* update.set("id", 3);
- *
+ *
* int rows = update.execute();
* System.out.println("rows updated:" + rows);
*
@@ -983,8 +950,7 @@ public final class Ebean {
* which is was created.
*
*
- * @param beanType
- * the class of entity to be fetched
+ * @param beanType the class of entity to be fetched
* @return A ORM Query object for this beanType
*/
public static Query createQuery(Class beanType) {
@@ -996,12 +962,10 @@ public final class Ebean {
* Parse the Ebean query language statement returning the query which can then
* be modified (add expressions, change order by clause, change maxRows, change
* fetch and select paths etc).
- *
+ *
*
Example
- *
* {@code
*
- *
* // Find order additionally fetching the customer, details and details.product name.
*
* String eql = "fetch customer fetch details fetch details.product (name) where id = :orderId ";
@@ -1023,9 +987,8 @@ public final class Ebean {
* }
*
* @param beanType The type of bean to fetch
- * @param eql The Ebean query
- * @param The type of the entity bean
- *
+ * @param eql The Ebean query
+ * @param The type of the entity bean
* @return The query with expressions defined as per the parsed query statement
*/
public static Query createQuery(Class beanType, String eql) {
@@ -1040,9 +1003,8 @@ public final class Ebean {
* exists is that people used to JPA will probably be looking for a
* createQuery method (the same as entityManager).
*
- *
- * @param beanType
- * the type of entity bean to find
+ *
+ * @param beanType the type of entity bean to find
* @return A ORM Query object for this beanType
*/
public static Query find(Class beanType) {
@@ -1103,28 +1065,24 @@ public final class Ebean {
*
* Example:
*
- *
* {@code
*
* // example that uses 'named' parameters
* String s = "UPDATE f_topic set post_count = :count where id = :id"
- *
+ *
* SqlUpdate update = Ebean.createSqlUpdate(s);
- *
+ *
* update.setParameter("id", 1);
* update.setParameter("count", 50);
- *
+ *
* int modifiedCount = Ebean.execute(update);
- *
+ *
* String msg = "There where " + modifiedCount + "rows updated";
*
* }
- *
- * @param sqlUpdate
- * the update sql potentially with bind values
- *
+ *
+ * @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 Ebean#execute(CallableSql)
@@ -1138,23 +1096,22 @@ public final class Ebean {
*
* Example:
*
- *
* {@code
*
* String sql = "{call sp_order_modify(?,?,?)}";
- *
+ *
* CallableSql cs = Ebean.createCallableSql(sql);
* cs.setParameter(1, 27);
* cs.setParameter(2, "SHIPPED");
* cs.registerOut(3, Types.INTEGER);
- *
+ *
* Ebean.execute(cs);
- *
+ *
* // read the out parameter
* Integer returnValue = (Integer) cs.getObject(3);
*
* }
- *
+ *
* @see CallableSql
* @see Ebean#execute(SqlUpdate)
*/
@@ -1168,7 +1125,6 @@ public final class Ebean {
* The scope can control the transaction type, isolation and rollback
* semantics.
*
- *
* {@code
*
* // set specific transactional scope settings
@@ -1193,17 +1149,16 @@ public final class Ebean {
* The default scope runs with REQUIRED and by default will rollback on any
* exception (checked or runtime).
*
- *
* {@code
*
* Ebean.execute(new TxRunnable() {
* public void run() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
- *
+ *
* u1.setName("u1 mod");
* u2.setName("u2 mod");
- *
+ *
* Ebean.save(u1);
* Ebean.save(u2);
* }
@@ -1221,7 +1176,6 @@ public final class Ebean {
* The scope can control the transaction type, isolation and rollback
* semantics.
*
- *
* {@code
*
* // set specific transactional scope settings
@@ -1236,7 +1190,6 @@ public final class Ebean {
* });
*
* }
- *
*/
public static T execute(TxScope scope, TxCallable c) {
return serverMgr.getDefaultServer().execute(scope, c);
@@ -1252,20 +1205,19 @@ public final class Ebean {
* This is basically the same as TxRunnable except that it returns an Object
* (and you specify the return type via generics).
*
- *
* {@code
*
* Ebean.execute(new TxCallable() {
* public String call() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
- *
+ *
* u1.setName("u1 mod");
* u2.setName("u2 mod");
- *
+ *
* Ebean.save(u1);
* Ebean.save(u2);
- *
+ *
* return u1.getEmail();
* }
* });
@@ -1300,15 +1252,11 @@ public final class Ebean {
* If there is NO current transaction when you call this method then this
* information is registered immediately (with the transaction manager).
*
- *
- * @param tableName
- * the name of the table that was modified
- * @param inserts
- * true if rows where inserted into the table
- * @param updates
- * true if rows on the table where updated
- * @param deletes
- * true if rows on the table where deleted
+ *
+ * @param tableName the name of the table that was modified
+ * @param inserts true if rows where inserted into the table
+ * @param updates true if rows on the table where updated
+ * @param deletes true if rows on the table where deleted
*/
public static void externalModification(String tableName, boolean inserts, boolean updates, boolean deletes) {
@@ -1327,7 +1275,6 @@ public final class Ebean {
/**
* Return the manager of the server cache ("L2" cache).
- *
*/
public static ServerCacheManager getServerCacheManager() {
return serverMgr.getDefaultServer().getServerCacheManager();
diff --git a/src/main/java/com/avaje/ebean/EbeanServer.java b/src/main/java/com/avaje/ebean/EbeanServer.java
index a2bb1f4b4..269625ce5 100644
--- a/src/main/java/com/avaje/ebean/EbeanServer.java
+++ b/src/main/java/com/avaje/ebean/EbeanServer.java
@@ -169,7 +169,7 @@ public interface EbeanServer {
*
* Useful if you use BeanPostConstructListeners or @PostConstruct Annotations.
* In this case you should not use "new Bean...()". Making all bean construtors protected
- * could be a good idea here.
+ * could be a good idea here.
*
*/
T createEntityBean(Class type);
@@ -224,9 +224,8 @@ public interface EbeanServer {
* Parse the Ebean query language statement returning the query which can then
* be modified (add expressions, change order by clause, change maxRows, change
* fetch and select paths etc).
- *
+ *
*
Example
- *
* {@code
*
* // Find order additionally fetching the customer, details and details.product name.
@@ -250,9 +249,8 @@ public interface EbeanServer {
* }
*
* @param beanType The type of bean to fetch
- * @param eql The Ebean query
- * @param The type of the entity bean
- *
+ * @param eql The Ebean query
+ * @param The type of the entity bean
* @return The query with expressions defined as per the parsed query statement
*/
Query createQuery(Class beanType, String eql);
@@ -752,7 +750,7 @@ public interface EbeanServer {
*
* @see Query#findIds()
*/
- List findIds(Query> query, Transaction transaction);
+ List findIds(Query query, Transaction transaction);
/**
* Return a QueryIterator for the query.
@@ -994,7 +992,7 @@ public interface EbeanServer {
/**
* Execute the query returning a list of values for a single property.
- *
+ *
*
Example 1:
* {@code
*
@@ -1005,7 +1003,6 @@ public interface EbeanServer {
* .findSingleAttributeList();
*
* }
- *
* Example 2:
* {@code
*
@@ -1021,10 +1018,9 @@ public interface EbeanServer {
* }
*
* @return the list of values for the selected property
- *
* @see Query#findSingleAttributeList()
*/
- List findSingleAttributeList(Query> query, Transaction transaction);
+ List findSingleAttributeList(Query query, Transaction transaction);
/**
* Execute the query returning at most one entity bean or null (if no matching
diff --git a/src/main/java/com/avaje/ebean/EbeanServerFactory.java b/src/main/java/com/avaje/ebean/EbeanServerFactory.java
index d6326b5ea..bcc9a2062 100644
--- a/src/main/java/com/avaje/ebean/EbeanServerFactory.java
+++ b/src/main/java/com/avaje/ebean/EbeanServerFactory.java
@@ -36,7 +36,7 @@ public class EbeanServerFactory {
/**
* Initialise the container with clustering configuration.
- *
+ *
* Call this prior to creating any EbeanServer instances or alternatively set the
* ContainerConfig on the ServerConfig when creating the first EbeanServer instance.
*/
diff --git a/src/main/java/com/avaje/ebean/ExampleExpression.java b/src/main/java/com/avaje/ebean/ExampleExpression.java
index e8fcf366a..6561ed76f 100644
--- a/src/main/java/com/avaje/ebean/ExampleExpression.java
+++ b/src/main/java/com/avaje/ebean/ExampleExpression.java
@@ -14,44 +14,44 @@ package com.avaje.ebean;
* To get control over the options you can create an ExampleExpression and set
* those options such as case insensitive etc.
*
- *
- *
+ *
+ * {@code
* // create an example bean and set the properties
* // with the query parameters you want
* Customer example = new Customer();
- * example.setName("Rob%");
- * example.setNotes("%something%");
- *
+ * example.setName("Rob%");
+ * example.setNotes("%something%");
+ *
* List<Customer> list =
* Ebean.find(Customer.class)
* .where()
* // pass the bean into the where() clause
* .exampleLike(example)
* // you can add other expressions to the same query
- * .gt("id", 2)
+ * .gt("id", 2)
* .findList();
- *
- *
- *
+ *
+ * }
+ *
* Similarly you can create an ExampleExpression
- *
- *
+ *
+ * {@code
+ *
* Customer example = new Customer();
- * example.setName("Rob%");
- * example.setNotes("%something%");
- *
+ * example.setName("Rob%");
+ * example.setNotes("%something%");
+ *
* // create a ExampleExpression with more control
* ExampleExpression qbe = new ExampleExpression(example, true, LikeType.EQUAL_TO)
* .includeZeros();
- *
- * List<Customer> list =
+ *
+ * List list =
* Ebean.find(Customer.class)
* .where()
* .add(qbe)
* .findList();
- *
- *
- * @author Rob Bygrave
+ *
+ * }
*/
public interface ExampleExpression extends Expression {
@@ -90,4 +90,4 @@ public interface ExampleExpression extends Expression {
*/
ExampleExpression useEqualTo();
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/Expr.java b/src/main/java/com/avaje/ebean/Expr.java
index a6a9e8b7c..41718174e 100644
--- a/src/main/java/com/avaje/ebean/Expr.java
+++ b/src/main/java/com/avaje/ebean/Expr.java
@@ -23,20 +23,19 @@ import java.util.Map;
* Creates standard common expressions for using in a Query Where or Having
* clause.
*
- *
- *
- * // Example: Using an Expr.or() method
- * Query<Order> query = Ebean.createQuery(Order.class);
- * query.where(
- * Expr.or(Expr.eq("status", Order.NEW),
- * Expr.gt("orderDate", lastWeek));
- *
- * List<Order> list = query.findList();
+ * {@code
+ *
+ * // Example: Using an Expr.or() method
+ * Query query = Ebean.createQuery(Order.class);
+ * query.where(
+ * Expr.or(Expr.eq("status", Order.NEW),
+ * Expr.gt("orderDate", lastWeek));
+ *
+ * List list = query.findList();
* ...
- *
- *
+ * }
+ *
* @see Query#where()
- * @author Rob Bygrave
*/
public class Expr {
@@ -77,10 +76,10 @@ public class Expr {
* Between - value between two given properties.
*/
public static Expression between(String lowProperty, String highProperty, Object value) {
-
+
return Ebean.getExpressionFactory().betweenProperties(lowProperty, highProperty, value);
}
-
+
/**
* Greater Than - property greater than the given value.
*/
@@ -142,8 +141,7 @@ public class Expr {
/**
* Create the query by Example expression specifying more options.
*/
- public static ExampleExpression exampleLike(Object example, boolean caseInsensitive,
- LikeType likeType) {
+ public static ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType) {
return Ebean.getExpressionFactory().exampleLike(example, caseInsensitive, likeType);
}
@@ -257,9 +255,8 @@ public class Expr {
* Expression where all the property names in the map are equal to the
* corresponding value.
*
- *
- * @param propertyMap
- * a map keyed by property names.
+ *
+ * @param propertyMap a map keyed by property names.
*/
public static Expression allEq(Map propertyMap) {
return Ebean.getExpressionFactory().allEq(propertyMap);
diff --git a/src/main/java/com/avaje/ebean/ExpressionFactory.java b/src/main/java/com/avaje/ebean/ExpressionFactory.java
index 2fb89e9b2..afa89b7b8 100644
--- a/src/main/java/com/avaje/ebean/ExpressionFactory.java
+++ b/src/main/java/com/avaje/ebean/ExpressionFactory.java
@@ -24,20 +24,19 @@ import java.util.Map;
*
* The ExpressionList is returned from {@link Query#where()}.
*
- *
- *
- * // Example: fetch orders where status equals new or orderDate > lastWeek.
- *
- * Expression newOrLastWeek =
- * Expr.or(Expr.eq("status", Order.Status.NEW),
- * Expr.gt("orderDate", lastWeek));
- *
- * Query<Order> query = Ebean.createQuery(Order.class);
+ * {@code
+ * // Example: fetch orders where status equals new or orderDate > lastWeek.
+ *
+ * Expression newOrLastWeek =
+ * Expr.or(Expr.eq("status", Order.Status.NEW),
+ * Expr.gt("orderDate", lastWeek));
+ *
+ * Query query = Ebean.createQuery(Order.class);
* query.where().add(newOrLastWeek);
- * List<Order> list = query.findList();
+ * List list = query.findList();
* ...
- *
- *
+ * }
+ *
* @see Query#where()
*/
public interface ExpressionFactory {
@@ -282,7 +281,7 @@ public interface ExpressionFactory {
* Exists expression
*/
Expression exists(Query> subQuery);
-
+
/**
* Not exists expression
*/
@@ -319,9 +318,8 @@ public interface ExpressionFactory {
* Expression where all the property names in the map are equal to the
* corresponding value.
*
- *
- * @param propertyMap
- * a map keyed by property names.
+ *
+ * @param propertyMap a map keyed by property names.
*/
Expression allEq(Map propertyMap);
diff --git a/src/main/java/com/avaje/ebean/ExpressionList.java b/src/main/java/com/avaje/ebean/ExpressionList.java
index 1d123899c..4164d5d2e 100644
--- a/src/main/java/com/avaje/ebean/ExpressionList.java
+++ b/src/main/java/com/avaje/ebean/ExpressionList.java
@@ -104,7 +104,7 @@ public interface ExpressionList {
* Perform an 'As of' query using history tables to return the object graph
* as of a time in the past.
*
- * To perform this query the DB must have underlying history tables.
+ * To perform this query the DB must have underlying history tables.
*
*
* @param asOf the date time in the past at which you want to view the data
@@ -201,7 +201,7 @@ public interface ExpressionList {
/**
* Execute the query returning a list of values for a single property.
- *
+ *
*
Example 1:
* {@code
*
@@ -212,7 +212,7 @@ public interface ExpressionList {
* .findSingleAttributeList();
*
* }
- *
+ *
*
Example 2:
* {@code
*
@@ -240,7 +240,6 @@ public interface ExpressionList {
*
*
* @throws NonUniqueResultException if more than one result was found
- *
* @see Query#findUnique()
*/
@Nullable
@@ -292,7 +291,7 @@ public interface ExpressionList {
* If maxRows is not set on the query prior to calling findPagedList() then a
* PersistenceException is thrown.
*
- *
+ *
*
{@code
*
* PagedList pagedList = Ebean.find(Order.class)
@@ -309,7 +308,6 @@ public interface ExpressionList {
* }
*
* @return The PagedList
- *
* @see Query#findPagedList()
*/
PagedList findPagedList();
@@ -317,8 +315,8 @@ public interface ExpressionList {
/**
* Return versions of a @History entity bean.
*
- * Generally this query is expected to be a find by id or unique predicates query.
- * It will execute the query against the history returning the versions of the bean.
+ * Generally this query is expected to be a find by id or unique predicates query.
+ * It will execute the query against the history returning the versions of the bean.
*
*/
List> findVersions();
@@ -326,8 +324,8 @@ public interface ExpressionList {
/**
* Return versions of a @History entity bean between the 2 timestamps.
*
- * Generally this query is expected to be a find by id or unique predicates query.
- * It will execute the query against the history returning the versions of the bean.
+ * Generally this query is expected to be a find by id or unique predicates query.
+ * It will execute the query against the history returning the versions of the bean.
*
*/
List> findVersionsBetween(Timestamp start, Timestamp end);
@@ -440,7 +438,6 @@ public interface ExpressionList {
/**
* Path exists - for the given path in a JSON document.
- *
* {@code
*
* where().jsonExists("content", "path.other")
@@ -448,13 +445,12 @@ public interface ExpressionList {
* }
*
* @param propertyName the property that holds a JSON document
- * @param path the nested path in the JSON document in dot notation
+ * @param path the nested path in the JSON document in dot notation
*/
ExpressionList jsonExists(String propertyName, String path);
/**
* Path does not exist - for the given path in a JSON document.
- *
* {@code
*
* where().jsonNotExists("content", "path.other")
@@ -462,13 +458,13 @@ public interface ExpressionList {
* }
*
* @param propertyName the property that holds a JSON document
- * @param path the nested path in the JSON document in dot notation
+ * @param path the nested path in the JSON document in dot notation
*/
ExpressionList jsonNotExists(String propertyName, String path);
/**
* Equal to expression for the value at the given path in the JSON document.
- *
+ *
*
{@code
*
* where().jsonEqualTo("content", "path.other", 34)
@@ -476,14 +472,14 @@ public interface ExpressionList {
* }
*
* @param propertyName the property that holds a JSON document
- * @param path the nested path in the JSON document in dot notation
- * @param value the value used to test against the document path's value
+ * @param path the nested path in the JSON document in dot notation
+ * @param value the value used to test against the document path's value
*/
ExpressionList jsonEqualTo(String propertyName, String path, Object value);
/**
* Not Equal to - for the given path in a JSON document.
- *
+ *
*
{@code
*
* where().jsonNotEqualTo("content", "path.other", 34)
@@ -491,14 +487,14 @@ public interface ExpressionList {
* }
*
* @param propertyName the property that holds a JSON document
- * @param path the nested path in the JSON document in dot notation
- * @param value the value used to test against the document path's value
+ * @param path the nested path in the JSON document in dot notation
+ * @param value the value used to test against the document path's value
*/
ExpressionList jsonNotEqualTo(String propertyName, String path, Object value);
/**
* Greater than - for the given path in a JSON document.
- *
+ *
*
{@code
*
* where().jsonGreaterThan("content", "path.other", 34)
@@ -509,7 +505,7 @@ public interface ExpressionList {
/**
* Greater than or equal to - for the given path in a JSON document.
- *
+ *
*
{@code
*
* where().jsonGreaterOrEqual("content", "path.other", 34)
@@ -520,7 +516,7 @@ public interface ExpressionList {
/**
* Less than - for the given path in a JSON document.
- *
+ *
*
{@code
*
* where().jsonLessThan("content", "path.other", 34)
@@ -531,7 +527,7 @@ public interface ExpressionList {
/**
* Less than or equal to - for the given path in a JSON document.
- *
+ *
*
{@code
*
* where().jsonLessOrEqualTo("content", "path.other", 34)
@@ -542,7 +538,7 @@ public interface ExpressionList {
/**
* Between - for the given path in a JSON document.
- *
+ *
*
{@code
*
* where().jsonBetween("content", "orderDate", lowerDateTime, upperDateTime)
@@ -556,7 +552,7 @@ public interface ExpressionList {
*
* This returns the list so that add() can be chained.
*
- *
+ *
*
{@code
*
* Query query = Ebean.find(Customer.class);
@@ -647,7 +643,7 @@ public interface ExpressionList {
* To get control over the options you can create an ExampleExpression and set
* those options such as case insensitive etc.
*
- *
+ *
*
{@code
*
* // create an example bean and set the properties
@@ -663,9 +659,9 @@ public interface ExpressionList {
* .gt("id", 2).findList();
*
* }
- *
+ *
* Similarly you can create an ExampleExpression
- *
+ *
*
{@code
*
* Customer example = new Customer();
@@ -804,8 +800,7 @@ public interface ExpressionList {
* corresponding value.
*
*
- * @param propertyMap
- * a map keyed by property names.
+ * @param propertyMap a map keyed by property names.
*/
ExpressionList allEq(Map propertyMap);
@@ -849,7 +844,7 @@ public interface ExpressionList {
* then they are not translated. logical property name names (not fully
* qualified) will still be translated to their physical name.
*
- *
+ *
*
Example:
* {@code
*
@@ -881,7 +876,7 @@ public interface ExpressionList {
* then they are not translated. logical property name names (not fully
* qualified) will still be translated to their physical name.
*
- *
+ *
*
{@code
*
* raw("orderQty < shipQty")
@@ -894,7 +889,7 @@ public interface ExpressionList {
* Add a match expression.
*
* @param propertyName The property name for the match
- * @param search The search value
+ * @param search The search value
*/
ExpressionList match(String propertyName, String search);
@@ -902,14 +897,14 @@ public interface ExpressionList {
* Add a match expression with options.
*
* @param propertyName The property name for the match
- * @param search The search value
+ * @param search The search value
*/
ExpressionList match(String propertyName, String search, Match options);
/**
* Add a multi-match expression.
*/
- ExpressionList multiMatch(String search, String... properties);
+ ExpressionList multiMatch(String search, String... properties);
/**
* Add a multi-match expression using options.
@@ -960,7 +955,7 @@ public interface ExpressionList {
* typically you only explicitly need to use the and() junction
* when it is nested inside an or() or not() junction.
*
- *
+ *
*
{@code
*
* // Example: Nested and()
@@ -985,11 +980,11 @@ public interface ExpressionList {
/**
* Return a list of expressions that will be joined by OR's.
* This is exactly the same as disjunction();
- *
*
- * Use endOr() or endJunction() to end the OR junction.
+ *
+ * Use endOr() or endJunction() to end the OR junction.
*
- *
+ *
*
{@code
*
* // Example: Use or() to join
@@ -1016,10 +1011,10 @@ public interface ExpressionList {
/**
* Return a list of expressions that will be wrapped by NOT.
*
- * Use endNot() or endJunction() to end expressions being added to the
- * NOT expression list.
+ * Use endNot() or endJunction() to end expressions being added to the
+ * NOT expression list.
*
- *
+ *
*
@{code
*
* .where()
@@ -1029,7 +1024,7 @@ public interface ExpressionList {
* .endNot()
*
* }
- *
+ *
*
@{code
*
* // Example: nested not()
diff --git a/src/main/java/com/avaje/ebean/FetchConfig.java b/src/main/java/com/avaje/ebean/FetchConfig.java
index fc4f3de11..fad86a69c 100644
--- a/src/main/java/com/avaje/ebean/FetchConfig.java
+++ b/src/main/java/com/avaje/ebean/FetchConfig.java
@@ -21,47 +21,52 @@ import java.io.Serializable;
* is high (a lot of "Many" beans per "One" bean) then this can be more
* efficient loaded as 2 SQL queries.
*
- *
+ *
*
{@code
* // Normal fetch join results in a single SQL query
* List list = Ebean.find(Order.class).fetch("details").findList();
- *
+ *
* // Find Orders join details using a single SQL query
* }
*
* Example: Using a "query join" instead of a "fetch join" we instead use 2 SQL queries
*
- *
+ *
*
{@code
+ *
* // This will use 2 SQL queries to build this object graph
* List list =
* Ebean.find(Order.class)
* .fetch("details", new FetchConfig().query())
* .findList();
- *
+ *
* // query 1) find order
* // query 2) find orderDetails where order.id in (?,?...) // first 100 order id's
+ *
* }
*
* Example: Using 2 "query joins"
*
- *
+ *
*
{@code
+ *
* // This will use 3 SQL queries to build this object graph
* List list =
* Ebean.find(Order.class)
* .fetch("details", new FetchConfig().query())
* .fetch("customer", new FetchConfig().queryFirst(5))
* .findList();
- *
+ *
* // query 1) find order
* // query 2) find orderDetails where order.id in (?,?...) // first 100 order id's
* // query 3) find customer where id in (?,?,?,?,?) // first 5 customers
+ *
* }
*
* Example: Using "query joins" and partial objects
*
- *
+ *
+ *
*
{@code
* // This will use 3 SQL queries to build this object graph
* List list =
@@ -73,13 +78,13 @@ import java.io.Serializable;
* .fetch("customer.contacts")
* .fetch("customer.shippingAddress")
* .findList();
- *
+ *
* // query 1) find order (status, shipDate)
* // query 2) find orderDetail (quantity, price) fetch product (sku, name) where
* // order.id in (?,? ...)
* // query 3) find customer (name) fetch contacts (*) fetch shippingAddress (*)
* // where id in (?,?,?,?,?)
- *
+ *
* // Note: the fetch of "details.product" is automatically included into the
* // fetch of "details"
* //
@@ -91,20 +96,21 @@ import java.io.Serializable;
* immediately and the lazy defines the batch size to use for further lazy
* loading (if lazy loading is invoked).
*
- *
+ *
*
{@code
+ *
* List list =
* Ebean.find(Order.class)
* .fetch("customer", new FetchConfig().query(10).lazy(5))
* .findList();
- *
+ *
* // query 1) find order
* // query 2) find customer where id in (?,?,?,?,?,?,?,?,?,?) // first 10 customers
* // .. then if lazy loading of customers is invoked
* // .. use a batch size of 5 to load the customers
- *
+ *
* }
- *
+ *
*
* Example of controlling the lazy loading query:
*
@@ -112,22 +118,23 @@ import java.io.Serializable;
* This gives us the ability to optimise the lazy loading query for a given use
* case.
*
- *
+ *
*
{@code
+ *
* List list = Ebean.find(Order.class)
* .fetch("customer","name", new FetchConfig().lazy(5))
* .fetch("customer.contacts","contactName, phone, email")
* .fetch("customer.shippingAddress")
* .where().eq("status",Order.Status.NEW)
* .findList();
- *
+ *
* // query 1) find order where status = Order.Status.NEW
- * //
- * // .. if lazy loading of customers is invoked
+ * //
+ * // .. if lazy loading of customers is invoked
* // .. use a batch size of 5 to load the customers
- *
+ *
* }
- *
+ *
* @author mario
* @author rbygrave
*/
@@ -159,9 +166,8 @@ public class FetchConfig implements Serializable {
/**
* Specify that this path should be lazy loaded with a specified batch size.
- *
- * @param lazyBatchSize
- * the batch size for lazy loading
+ *
+ * @param lazyBatchSize the batch size for lazy loading
*/
public FetchConfig lazy(int lazyBatchSize) {
this.lazyBatchSize = lazyBatchSize;
@@ -193,9 +199,8 @@ public class FetchConfig implements Serializable {
* This will load all beans on this path eagerly unless a {@link #lazy(int)}
* is also used.
*
- *
- * @param queryBatchSize
- * the batch size used to load beans on this path
+ *
+ * @param queryBatchSize the batch size used to load beans on this path
*/
public FetchConfig query(int queryBatchSize) {
this.queryBatchSize = queryBatchSize;
@@ -211,9 +216,8 @@ public class FetchConfig implements Serializable {
* If there are more parent beans than the batch size then they will not be
* loaded eagerly but instead use lazy loading.
*
- *
- * @param queryBatchSize
- * the number of parent beans this path is populated for
+ *
+ * @param queryBatchSize the number of parent beans this path is populated for
*/
public FetchConfig queryFirst(int queryBatchSize) {
this.queryBatchSize = queryBatchSize;
@@ -227,7 +231,7 @@ public class FetchConfig implements Serializable {
public int getLazyBatchSize() {
return lazyBatchSize;
}
-
+
/**
* Return the batch size for separate query load.
*/
diff --git a/src/main/java/com/avaje/ebean/Filter.java b/src/main/java/com/avaje/ebean/Filter.java
index f5055123c..f8e1aab16 100644
--- a/src/main/java/com/avaje/ebean/Filter.java
+++ b/src/main/java/com/avaje/ebean/Filter.java
@@ -19,64 +19,63 @@ import java.util.Set;
* The result of the filter method will leave the original list unmodified and
* return a new List instance.
*
- *
- *
- *
+ *
+ *
{@code
+ *
* // get a list of entities (query execution statistics in this case)
- *
- * List<MetaQueryStatistic> list =
+ *
+ * List list =
* Ebean.find(MetaQueryStatistic.class).findList();
- *
+ *
* long nowMinus24Hrs = System.currentTimeMillis() - 24 * (1000 * 60 * 60);
- *
+ *
* // sort and filter the list returning a filtered list...
- *
- * List<MetaQueryStatistic> filteredList =
+ *
+ * List filteredList =
* Ebean.filter(MetaQueryStatistic.class)
- * .sort("avgTimeMicros desc")
- * .gt("executionCount", 0)
- * .gt("lastQueryTime", nowMinus24Hrs)
- * .eq("autoTuned", true)
+ * .sort("avgTimeMicros desc")
+ * .gt("executionCount", 0)
+ * .gt("lastQueryTime", nowMinus24Hrs)
+ * .eq("autoTuned", true)
* .maxRows(10)
* .filter(list);
- *
- *
+ *
+ * }
*
* The propertyNames can traverse the object graph (e.g. customer.name) by using
* dot notation. If any point during the object graph traversal to get a
* property value is null then null is returned.
*
- *
- *
- * // examples of property names that
+ *
+ *
{@code
+ *
+ * // examples of property names that
* // ... will traverse the object graph
* // ... where customer is a property of our bean
- *
+ *
* customer.name
* customer.shippingAddress.city
- *
- *
- *
- *
- *
- *
+ *
+ * }
+ *
+ *
{@code
+ *
* // get a list of entities (query execution statistics)
- *
- * List<Order> orders =
+ *
+ * List orders =
* Ebean.find(Order.class).findList();
- *
+ *
* // Apply a filter...
- *
- * List<Order> filteredOrders =
+ *
+ * List filteredOrders =
* Ebean.filter(Order.class)
- * .startsWith("customer.name", "Rob")
- * .eq("customer.shippingAddress.city", "Auckland")
+ * .startsWith("customer.name", "Rob")
+ * .eq("customer.shippingAddress.city", "Auckland")
* .filter(orders);
- *
- *
- *
- * @param
- * the entity bean type
+ *
+ * }
+ *
+ * @param the entity bean type
*/
public interface Filter {
@@ -189,9 +188,9 @@ public interface Filter {
*
* The sourceList will remain unmodified.
*
- *
+ *
* @return Returns a new list with the sorting and filters applied.
*/
List filter(List sourceList);
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/Finder.java b/src/main/java/com/avaje/ebean/Finder.java
index beacbea49..6cd7cf1bd 100644
--- a/src/main/java/com/avaje/ebean/Finder.java
+++ b/src/main/java/com/avaje/ebean/Finder.java
@@ -11,11 +11,10 @@ import java.util.List;
* These 'finders' are a place to organise all the finder methods for that bean type
* and specific finder methods are expected to be added (find by unique properties etc).
*
- *
* Testing
*
- * For testing the mocki-ebean project has the ability to replace the finder implementation
- *
+ * For testing the mocki-ebean project has the ability to replace the finder implementation
+ *
*
* {@code
*
@@ -61,7 +60,6 @@ public class Finder {
/**
* Create with the type of the entity bean.
- *
* {@code
*
* public class CustomerFinder extends Finder {
@@ -96,10 +94,8 @@ public class Finder {
/**
* Return the underlying 'default' EbeanServer.
- *
*
* This provides full access to the API such as explicit transaction demarcation etc.
- *
*/
public EbeanServer db() {
return Ebean.getServer(serverName);
@@ -110,9 +106,8 @@ public class Finder {
*
* This is equivalent to {@link Ebean#getServer(String)}
*
- * @param server
- * The name of the EbeanServer. If this is null then the default EbeanServer is
- * returned.
+ * @param server The name of the EbeanServer. If this is null then the default EbeanServer is
+ * returned.
*/
public EbeanServer db(String server) {
return Ebean.getServer(server);
@@ -120,7 +115,6 @@ public class Finder {
/**
* Creates an entity reference for this ID.
- *
*
* Equivalent to {@link EbeanServer#getReference(Class, Object)}
*/
@@ -130,7 +124,6 @@ public class Finder {
/**
* Retrieves an entity by ID.
- *
*
* Equivalent to {@link EbeanServer#find(Class, Object)}
*/
diff --git a/src/main/java/com/avaje/ebean/FutureList.java b/src/main/java/com/avaje/ebean/FutureList.java
index 105a8c411..34301d446 100644
--- a/src/main/java/com/avaje/ebean/FutureList.java
+++ b/src/main/java/com/avaje/ebean/FutureList.java
@@ -17,31 +17,30 @@ import java.util.concurrent.TimeoutException;
*
* A simple example:
*
- *
* {@code
+ *
* // create a query to find all orders
* Query query = Ebean.find(Order.class);
- *
+ *
* // execute the query in a background thread
* // immediately returning the futureList
* FutureList futureList = query.findFutureList();
- *
- * // do something else ...
- *
+ *
+ * // do something else ...
+ *
* if (!futureList.isDone()){
* // we can cancel the query execution. This will cancel
* // the underlying query if that is supported by the JDBC
* // driver and database
* futureList.cancel(true);
* }
- *
- *
+ *
* if (!futureList.isCancelled()){
* // wait for the query to finish and return the list
* List list = futureList.get();
* ...
* }
- *
+ *
* }
*/
public interface FutureList extends Future> {
@@ -56,7 +55,6 @@ public interface FutureList extends Future> {
* unchecked PersistenceException.
*
* @return The query list result
- *
* @throws PersistenceException when a InterruptedException or ExecutionException occurs.
*/
List getUnchecked();
@@ -66,8 +64,7 @@ public interface FutureList extends Future> {
* and ExecutionException in the unchecked PersistenceException.
*
* @return The query list result
- *
- * @throws TimeoutException if the wait timed out
+ * @throws TimeoutException if the wait timed out
* @throws PersistenceException if a InterruptedException or ExecutionException occurs.
*/
List getUnchecked(long timeout, TimeUnit unit) throws TimeoutException;
diff --git a/src/main/java/com/avaje/ebean/FutureRowCount.java b/src/main/java/com/avaje/ebean/FutureRowCount.java
index 36aa6ab33..959846796 100644
--- a/src/main/java/com/avaje/ebean/FutureRowCount.java
+++ b/src/main/java/com/avaje/ebean/FutureRowCount.java
@@ -8,7 +8,8 @@ import java.util.concurrent.Future;
*
* It extends the java.util.concurrent.Future.
*
- *
+ *
+ * @param the BeanType
* @author rbygrave
*/
public interface FutureRowCount extends Future {
diff --git a/src/main/java/com/avaje/ebean/Junction.java b/src/main/java/com/avaje/ebean/Junction.java
index 35ec6aa90..8437f53e6 100644
--- a/src/main/java/com/avaje/ebean/Junction.java
+++ b/src/main/java/com/avaje/ebean/Junction.java
@@ -9,7 +9,6 @@ package com.avaje.ebean;
*
* Note: where() always takes you to the top level WHERE expression list.
*
- *
* {@code
* Query q =
* Ebean.find(Person.class)
@@ -23,13 +22,13 @@ package com.avaje.ebean;
*
* // read as...
* // where ( ((name like Rob%) or (status = NEW)) AND (id > 10) )
- * }
*
+ * }
*
* Note: endJunction() takes you to the parent expression list
*
- *
* {@code
+ *
* Query q =
* Ebean.find(Person.class)
* .where()
@@ -46,11 +45,9 @@ package com.avaje.ebean;
* // read as...
* // where ( ((name like Rob%) or (status = NEW)) AND (id > 10) )
* }
- *
*
* Example of a nested disjunction.
*
- *
* {@code
* Query q =
* Ebean.find(Customer.class)
@@ -96,6 +93,11 @@ public interface Junction extends Expression, ExpressionList {
*/
NOT(" and ", "not ", false),
+ /**
+ * FILTER group (for internal use only).
+ */
+ FILTER("filter", "", true),
+
/**
* Text search AND group.
*/
diff --git a/src/main/java/com/avaje/ebean/Model.java b/src/main/java/com/avaje/ebean/Model.java
index f03e52706..af8fa20c6 100644
--- a/src/main/java/com/avaje/ebean/Model.java
+++ b/src/main/java/com/avaje/ebean/Model.java
@@ -13,31 +13,26 @@ import java.util.UUID;
/**
* A MappedSuperclass base class that provides convenience methods for inserting, updating and
* deleting beans.
- *
*
* By having your entity beans extend this it provides a 'Active Record' style programming model for
* Ebean users.
- *
*
* Note that there is a avaje-ebeanorm-mocker project that enables you to use Mockito or similar
* tools to still mock out the underlying 'default EbeanServer' for testing purposes.
- *
*
* You may choose not use this Model mapped superclass if you don't like the 'Active Record' style
* or if you believe it 'pollutes' your entity beans.
- *
*
* You can use Dependency Injection like Guice or Spring to construct and wire a EbeanServer instance
* and have that same instance used with this Model and Finder. The way that works is that when the
* DI container creates the EbeanServer instance it can be registered with the Ebean singleton. In this
* way the EbeanServer instance can be injected as per normal Guice / Spring dependency injection and
* that same instance also used to support the Model and Finder active record style.
- *
*
* If you choose to use the Model mapped superclass you will probably also chose to additionally add
* a {@link Find} as a public static field to complete the active record pattern and provide a
* relatively nice clean way to write queries.
- *
+ *
*
Typical common @MappedSuperclass
* {@code
*
@@ -58,7 +53,7 @@ import java.util.UUID;
* ...
*
* }
- *
+ *
*
Extend the Model
* {@code
*
@@ -78,7 +73,7 @@ import java.util.UUID;
* }
*
* }
- *
+ *
*
Modal: save()
* {@code
*
@@ -90,7 +85,7 @@ import java.util.UUID;
* customer.save();
*
* }
- *
+ *
*
Find byId
* {@code
*
@@ -98,7 +93,7 @@ import java.util.UUID;
* Customer customer = Customer.find.byId(42);
*
* }
- *
+ *
*
Find where
* {@code
*
@@ -115,39 +110,37 @@ public abstract class Model {
/**
* Return the underlying 'default' EbeanServer.
- *
*
* This provides full access to the API such as explicit transaction demarcation etc.
- *
*
* Example:
*
{@code
*
* Transaction transaction = Customer.db().beginTransaction();
* try {
- *
+ *
* // turn off cascade persist for this transaction
* transaction.setPersistCascade(false);
- *
+ *
* // extra control over jdbc batching for this transaction
* transaction.setBatchGetGeneratedKeys(false);
* transaction.setBatchMode(true);
* transaction.setBatchSize(20);
- *
+ *
* Customer customer = new Customer();
* customer.setName("Roberto");
* customer.save();
- *
+ *
* Customer otherCustomer = new Customer();
* otherCustomer.setName("Franko");
* otherCustomer.save();
- *
+ *
* transaction.commit();
- *
+ *
* } finally {
* transaction.end();
* }
- *
+ *
* }
*/
public static EbeanServer db() {
@@ -156,13 +149,11 @@ public abstract class Model {
/**
* Return a named EbeanServer that is typically different to the default server.
- *
*
* If you are using multiple databases then each database has a name and maps to a single
* EbeanServer. You can use this method to get an EbeanServer for another database.
- *
- * @param server
- * The name of the EbeanServer. If this is null then the default EbeanServer is returned.
+ *
+ * @param server The name of the EbeanServer. If this is null then the default EbeanServer is returned.
*/
public static EbeanServer db(String server) {
return Ebean.getServer(server);
@@ -176,16 +167,16 @@ public abstract class Model {
*
* An unmodified bean that is saved or updated is normally skipped and this marks the bean as
* dirty so that it is not skipped.
- *
+ *
*
{@code
- *
+ *
* Customer customer = Customer.find.byId(id);
- *
+ *
* // mark the bean as dirty so that a save() or update() will
* // increment the version property
* customer.markAsDirty();
* customer.save();
- *
+ *
* }
*
* @see EbeanServer#markAsDirty(Object)
@@ -197,7 +188,7 @@ public abstract class Model {
/**
* Mark the property as unset or 'not loaded'.
*
- * This would be used to specify a property that we did not wish to include in a stateless update.
+ * This would be used to specify a property that we did not wish to include in a stateless update.
*
* {@code
*
@@ -215,12 +206,11 @@ public abstract class Model {
* @param propertyName the name of the property on the bean to be marked as 'unset'
*/
public void markPropertyUnset(String propertyName) {
- ((EntityBean)this)._ebean_getIntercept().setPropertyLoaded(propertyName, false);
+ ((EntityBean) this)._ebean_getIntercept().setPropertyLoaded(propertyName, false);
}
/**
* Insert or update this entity depending on its state.
- *
*
* Ebean will detect if this is a new bean or a previously fetched bean and perform either an
* insert or an update based on that.
@@ -319,6 +309,7 @@ public abstract class Model {
* It should be preferred to use {@link Find} instead of Finder as that can use reflection to determine the class
* literal type of the entity bean.
*
+ *
* @param type of the Id property
* @param type of the entity bean
*/
@@ -326,7 +317,7 @@ public abstract class Model {
/**
* Create with the type of the entity bean.
- *
+ *
*
{@code
*
* @Entity
@@ -336,11 +327,11 @@ public abstract class Model {
* ...
*
* }
- *
+ *
*
* The preferred approach is to instead use Find as below. This approach is more DRY in that it does
* not require the class literal Customer.class to be passed into the constructor.
- *
+ *
*
{@code
*
* @Entity
@@ -366,13 +357,13 @@ public abstract class Model {
/**
* Helper object for performing queries.
- *
+ *
*
* Typically a Find instance is defined as a public static field on an entity bean class to provide a
* nice way to write queries.
- *
+ *
*
Example use:
- *
+ *
*
{@code
*
* @Entity
@@ -395,7 +386,7 @@ public abstract class Model {
* .findList();
*
* }
- *
+ *
*
Kotlin
* In Kotlin you would typically create Find as a companion object.
* {@code
@@ -404,12 +395,10 @@ public abstract class Model {
* companion object : Model.Find() {}
*
* }
- * @param
- * The Id type. This is most often a {@link Long} but is also often a {@link UUID} or
- * {@link String}.
*
- * @param
- * The entity bean type
+ * @param The Id type. This is most often a {@link Long} but is also often a {@link UUID} or
+ * {@link String}.
+ * @param The entity bean type
*/
public static abstract class Find {
@@ -427,11 +416,11 @@ public abstract class Model {
* Creates a finder for entity of type T with ID of type I.
*
* Typically you create Find as a public static field on each entity bean as the example below.
- *
+ *
*
* Note that Find is an abstract class and hence {} is required. This is done so
* that the type (class literal) of the entity bean can be derived from the generics parameter.
- *
+ *
*
{@code
*
* @Entity
@@ -456,10 +445,10 @@ public abstract class Model {
* .findList();
*
* }
- *
+ *
*
Kotlin
* In Kotlin you would typically create it as a companion object.
- *
+ *
*
{@code
*
* // kotlin
@@ -470,7 +459,7 @@ public abstract class Model {
@SuppressWarnings("unchecked")
public Find() {
this.serverName = null;
- this.type = (Class)ClassUtil.getSecondArgumentType(getClass());
+ this.type = (Class) ClassUtil.getSecondArgumentType(getClass());
}
/**
@@ -483,10 +472,9 @@ public abstract class Model {
/**
* Return the underlying 'default' EbeanServer.
- *
+ *
*
* This provides full access to the API such as explicit transaction demarcation etc.
- *
*/
public EbeanServer db() {
return Ebean.getServer(serverName);
@@ -496,10 +484,9 @@ public abstract class Model {
* Return typically a different EbeanServer to the default.
*
* This is equivalent to {@link Ebean#getServer(String)}
- *
- * @param server
- * The name of the EbeanServer. If this is null then the default EbeanServer is
- * returned.
+ *
+ * @param server The name of the EbeanServer. If this is null then the default EbeanServer is
+ * returned.
*/
public EbeanServer db(String server) {
return Ebean.getServer(server);
@@ -507,12 +494,12 @@ public abstract class Model {
/**
* Creates a Finder for the named EbeanServer.
- *
+ *
*
* Create and return a new Finder for a different server.
*/
public Finder on(String server) {
- return new Finder(server, type);
+ return new Finder<>(server, type);
}
/**
@@ -526,7 +513,7 @@ public abstract class Model {
/**
* Retrieves all entities of the given type.
- *
+ *
*
* This is the same as (synonym for) {@link #findList()}
*/
@@ -536,7 +523,7 @@ public abstract class Model {
/**
* Retrieves an entity by ID.
- *
+ *
*
* Equivalent to {@link EbeanServer#find(Class, Object)}
*/
@@ -547,7 +534,7 @@ public abstract class Model {
/**
* Creates an entity reference for this ID.
- *
+ *
*
* Equivalent to {@link EbeanServer#getReference(Class, Object)}
*/
@@ -585,7 +572,7 @@ public abstract class Model {
/**
* Returns the next identity value.
- *
+ *
* @see EbeanServer#nextId(Class)
*/
@SuppressWarnings("unchecked")
@@ -693,6 +680,7 @@ public abstract class Model {
/**
* Deprecated in favor of findCount().
+ *
* @deprecated
*/
public int findRowCount() {
@@ -829,7 +817,7 @@ public abstract class Model {
/**
* Sets the ID value to query.
- *
+ *
*
* Use this to perform a find byId query but with additional control over the query such as
* using select and fetch to control what parts of the object graph are returned.
@@ -858,7 +846,7 @@ public abstract class Model {
/**
* Create a query with the select with "for update" specified.
- *
+ *
*
* This will typically create row level database locks on the selected rows.
*/
@@ -895,4 +883,4 @@ public abstract class Model {
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/OrderBy.java b/src/main/java/com/avaje/ebean/OrderBy.java
index ff1b8cc1c..b62041cbf 100644
--- a/src/main/java/com/avaje/ebean/OrderBy.java
+++ b/src/main/java/com/avaje/ebean/OrderBy.java
@@ -28,9 +28,9 @@ public final class OrderBy implements Serializable {
* Create an empty OrderBy with no associated query.
*/
public OrderBy() {
- this.list = new ArrayList(3);
+ this.list = new ArrayList<>(3);
}
-
+
private OrderBy(List list) {
this.list = list;
}
@@ -52,7 +52,7 @@ public final class OrderBy implements Serializable {
*/
public OrderBy(Query query, String orderByClause) {
this.query = query;
- this.list = new ArrayList(3);
+ this.list = new ArrayList<>(3);
parse(orderByClause);
}
@@ -60,8 +60,8 @@ public final class OrderBy implements Serializable {
* Reverse the ascending/descending order on all the properties.
*/
public void reverse() {
- for (int i = 0; i < list.size(); i++) {
- list.get(i).reverse();
+ for (Property aList : list) {
+ aList.reverse();
}
}
@@ -88,8 +88,8 @@ public final class OrderBy implements Serializable {
*/
public boolean containsProperty(String propertyName) {
- for (int i = 0; i < list.size(); i++) {
- if (propertyName.equals(list.get(i).getProperty())) {
+ for (Property aList : list) {
+ if (propertyName.equals(aList.getProperty())) {
return true;
}
}
@@ -100,13 +100,13 @@ public final class OrderBy implements Serializable {
* Return a copy of this OrderBy with the path trimmed.
*/
public OrderBy copyWithTrim(String path) {
- List newList = new ArrayList(list.size());
- for (int i = 0; i < list.size(); i++) {
- newList.add(list.get(i).copyWithTrim(path));
+ List newList = new ArrayList<>(list.size());
+ for (Property aList : list) {
+ newList.add(aList.copyWithTrim(path));
}
- return new OrderBy(newList);
+ return new OrderBy<>(newList);
}
-
+
/**
* Return the properties for this OrderBy.
*/
@@ -141,9 +141,9 @@ public final class OrderBy implements Serializable {
*/
public OrderBy copy() {
- OrderBy copy = new OrderBy();
- for (int i = 0; i < list.size(); i++) {
- copy.add(list.get(i).copy());
+ OrderBy copy = new OrderBy<>();
+ for (Property aList : list) {
+ copy.add(aList.copy());
}
return copy;
}
@@ -192,7 +192,7 @@ public final class OrderBy implements Serializable {
if (!(obj instanceof OrderBy>)) {
return false;
}
-
+
OrderBy> e = (OrderBy>) obj;
return e.list.equals(list);
}
@@ -294,7 +294,7 @@ public final class OrderBy implements Serializable {
sb.append(" ").append("desc");
}
sb.append(" ").append(nulls).append(" ").append(highLow);
- return sb.toString();
+ return sb.toString();
}
}
@@ -356,8 +356,8 @@ public final class OrderBy implements Serializable {
}
String[] chunks = orderByClause.split(",");
- for (int i = 0; i < chunks.length; i++) {
- String[] pairs = chunks[i].split(" ");
+ for (String chunk : chunks) {
+ String[] pairs = chunk.split(" ");
Property p = parseProperty(pairs);
if (p != null) {
list.add(p);
@@ -370,10 +370,10 @@ public final class OrderBy implements Serializable {
return null;
}
- ArrayList wordList = new ArrayList(pairs.length);
- for (int i = 0; i < pairs.length; i++) {
- if (!isEmptyString(pairs[i])) {
- wordList.add(pairs[i]);
+ ArrayList wordList = new ArrayList<>(pairs.length);
+ for (String pair : pairs) {
+ if (!isEmptyString(pair)) {
+ wordList.add(pair);
}
}
if (wordList.isEmpty()) {
diff --git a/src/main/java/com/avaje/ebean/PagedList.java b/src/main/java/com/avaje/ebean/PagedList.java
index 3bd67beae..253641784 100644
--- a/src/main/java/com/avaje/ebean/PagedList.java
+++ b/src/main/java/com/avaje/ebean/PagedList.java
@@ -8,7 +8,7 @@ import java.util.concurrent.Future;
*
* The benefit of using PagedList over just using the normal Query with
* {@link Query#setFirstRow(int)} and {@link Query#setMaxRows(int)} is that it additionally wraps
- * functionality that can call {@link Query#findFutureRowCount()} to determine total row count,
+ * functionality that can call {@link Query#findFutureCount()} to determine total row count,
* total page count etc.
*
*
@@ -16,8 +16,7 @@ import java.util.concurrent.Future;
* the query. This translates into SQL that uses limit offset, rownum or row_number function to
* limit the result set.
*
- *
- *
+ *
*
Example: typical use including total row count
* {@code
*
@@ -43,8 +42,7 @@ import java.util.concurrent.Future;
* int totalRowCount = pagedList.getTotalRowCount();
*
* }
- *
- *
+ *
*
Example: No total row count required
* {@code
*
@@ -57,9 +55,7 @@ import java.util.concurrent.Future;
*
* }
*
- * @param
- * the entity bean type
- *
+ * @param the entity bean type
* @see Query#findPagedList()
*/
public interface PagedList {
@@ -79,7 +75,6 @@ public interface PagedList {
* int totalRowCount = pagedList.getTotalRowCount();
*
* }
- *
*
* Also note that using loadRowCount() and getTotalRowCount() rather than getFutureRowCount()
* means that exceptions ExecutionException, InterruptedException, TimeoutException are instead
@@ -192,11 +187,8 @@ public interface PagedList {
* the total row count query if it has not already been invoked.
*
*
- * @param to
- * String to put between the first and last row
- * @param of
- * String to put between the last row and the total row count
- *
+ * @param to String to put between the first and last row
+ * @param of String to put between the last row and the total row count
* @return String of the format XtoYofZ.
*/
String getDisplayXtoYofZ(String to, String of);
diff --git a/src/main/java/com/avaje/ebean/PersistenceIOException.java b/src/main/java/com/avaje/ebean/PersistenceIOException.java
index 08c26556f..bef4da6da 100644
--- a/src/main/java/com/avaje/ebean/PersistenceIOException.java
+++ b/src/main/java/com/avaje/ebean/PersistenceIOException.java
@@ -7,6 +7,8 @@ import javax.persistence.PersistenceException;
*/
public class PersistenceIOException extends PersistenceException {
+ private static final long serialVersionUID = -7630050437148176148L;
+
public PersistenceIOException(String msg, Exception cause) {
super(msg, cause);
}
diff --git a/src/main/java/com/avaje/ebean/Query.java b/src/main/java/com/avaje/ebean/Query.java
index a3fc51e58..d09d53af8 100644
--- a/src/main/java/com/avaje/ebean/Query.java
+++ b/src/main/java/com/avaje/ebean/Query.java
@@ -724,7 +724,7 @@ public interface Query {
/**
* Execute the query returning a list of values for a single property.
- *
+ *
*
Example 1:
* {@code
*
@@ -735,7 +735,7 @@ public interface Query {
* .findSingleAttributeList();
*
* }
- *
+ *
*
Example 2:
* {@code
*
diff --git a/src/main/java/com/avaje/ebean/QueryEachConsumer.java b/src/main/java/com/avaje/ebean/QueryEachConsumer.java
index f7de39953..6aa3f54fa 100644
--- a/src/main/java/com/avaje/ebean/QueryEachConsumer.java
+++ b/src/main/java/com/avaje/ebean/QueryEachConsumer.java
@@ -11,7 +11,7 @@ package com.avaje.ebean;
* all the beans in the query result to be held in memory at once. This makes
* QueryResultVisitor useful for processing large queries.
*
- *
+ *
*
{@code
*
* Query query = server.find(Customer.class)
@@ -25,17 +25,15 @@ package com.avaje.ebean;
* });
*
* }
- *
- * @param
- * the type of entity bean being queried.
+ *
+ * @param the type of entity bean being queried.
*/
public interface QueryEachConsumer {
/**
* Process the bean.
- *
- * @param bean
- * the entity bean to process
+ *
+ * @param bean the entity bean to process
*/
void accept(T bean);
}
diff --git a/src/main/java/com/avaje/ebean/QueryEachWhileConsumer.java b/src/main/java/com/avaje/ebean/QueryEachWhileConsumer.java
index 251fd4326..54dfb9597 100644
--- a/src/main/java/com/avaje/ebean/QueryEachWhileConsumer.java
+++ b/src/main/java/com/avaje/ebean/QueryEachWhileConsumer.java
@@ -12,23 +12,24 @@ package com.avaje.ebean;
* QueryResultVisitor useful for processing large queries.
*
*
- *
+ * {@code
*
- * Query<Customer> query = server.find(Customer.class)
- * .fetch("contacts", new FetchConfig().query(2))
- * .where().gt("id", 0)
- * .orderBy("id")
+ * Query query = server.find(Customer.class)
+ * .fetchQuery("contacts")
+ * .where().gt("id", 0)
+ * .orderBy("id")
* .setMaxRows(2);
*
* query.findEachWhile((Customer customer) -> {
*
* // do something with customer
- * System.out.println("-- visit " + customer);
+ * System.out.println("-- visit " + customer);
*
* // return true to continue processing or false to stop
* return (customer.getId() < 40);
* });
- *
+ *
+ * }
*
* @param the type of entity bean being queried.
*/
diff --git a/src/main/java/com/avaje/ebean/QueryIterator.java b/src/main/java/com/avaje/ebean/QueryIterator.java
index 23bfaea55..96787bd3f 100644
--- a/src/main/java/com/avaje/ebean/QueryIterator.java
+++ b/src/main/java/com/avaje/ebean/QueryIterator.java
@@ -19,9 +19,8 @@ import java.util.Iterator;
* Remember that with {@link QueryIterator} you must call {@link QueryIterator#close()}
* when you have finished iterating the results (typically in a finally block).
*
- *
* {@code
- *
+ *
* Query query = server.find(Customer.class)
* .where().gt("id", 0)
* .orderBy("id")
@@ -39,9 +38,8 @@ import java.util.Iterator;
* }
*
* }
- *
- * @param
- * the type of entity bean in the iteration
+ *
+ * @param the type of entity bean in the iteration
*/
public interface QueryIterator extends Iterator, java.io.Closeable {
diff --git a/src/main/java/com/avaje/ebean/RawSql.java b/src/main/java/com/avaje/ebean/RawSql.java
index a5488de72..b5ca778d2 100644
--- a/src/main/java/com/avaje/ebean/RawSql.java
+++ b/src/main/java/com/avaje/ebean/RawSql.java
@@ -1,10 +1,15 @@
package com.avaje.ebean;
+import com.avaje.ebean.util.CamelCaseHelper;
+
import java.io.Serializable;
import java.sql.ResultSet;
-import java.util.*;
-
-import com.avaje.ebean.util.CamelCaseHelper;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
/**
* Used to build object graphs based on a raw SQL statement (rather than
@@ -51,39 +56,38 @@ import com.avaje.ebean.util.CamelCaseHelper;
* to hold the values for the aggregate functions (sum etc) and a @OneToOne
* to Order.
*
- *
+ *
*
Example OrderAggregate
- *
* {@code
* ...
* // @Sql indicates to that this bean
* // is based on RawSql rather than a table
- *
+ *
* @Entity
* @Sql
* public class OrderAggregate {
- *
+ *
* @OneToOne
* Order order;
- *
+ *
* Double totalAmount;
- *
+ *
* Double totalItems;
- *
+ *
* // getters and setters
* ...
*
* }
- *
+ *
*
Example 1:
- *
+ *
*
{@code
*
* String sql = " select order_id, o.status, c.id, c.name, sum(d.order_qty*d.unit_price) as totalAmount"
* + " from o_order o"
* + " join o_customer c on c.id = o.kcustomer_id "
* + " join o_order_detail d on d.order_id = o.id " + " group by order_id, o.status ";
- *
+ *
* RawSql rawSql = RawSqlBuilder.parse(sql)
* // map the sql result columns to bean properties
* .columnMapping("order_id", "order.id")
@@ -93,35 +97,34 @@ import com.avaje.ebean.util.CamelCaseHelper;
* // we don't need to map this one due to the sql column alias
* // .columnMapping("sum(d.order_qty*d.unit_price)", "totalAmount")
* .create();
- *
+ *
* List list = Ebean.find(OrderAggregate.class)
* .setRawSql(rawSql)
* .where().gt("order.id", 0)
* .having().gt("totalAmount", 20)
* .findList();
- *
+ *
*
* }
- *
+ *
*
Example 2:
- *
*
* The following example uses a FetchConfig().query() so that after the initial
* RawSql query is executed Ebean executes a secondary query to fetch the
* associated order status, orderDate along with the customer name.
*
- *
+ *
*
{@code
*
* String sql = " select order_id, 'ignoreMe', sum(d.order_qty*d.unit_price) as totalAmount "
* + " from o_order_detail d"
* + " group by order_id ";
- *
+ *
* RawSql rawSql = RawSqlBuilder.parse(sql)
* .columnMapping("order_id", "order.id")
* .columnMappingIgnore("'ignoreMe'")
* .create();
- *
+ *
* List orders = Ebean.find(OrderAggregate.class)
* .setRawSql(rawSql)
* .fetch("order", "status,orderDate", new FetchConfig().query())
@@ -131,13 +134,12 @@ import com.avaje.ebean.util.CamelCaseHelper;
* .order().desc("totalAmount")
* .setMaxRows(10)
* .findList();
- *
+ *
* }
- *
- *
+ *
*
Example 3: tableAliasMapping
*
- * Instead of mapping each column you can map each table alias to a path using tableAliasMapping().
+ * Instead of mapping each column you can map each table alias to a path using tableAliasMapping().
*
* {@code
*
@@ -162,19 +164,17 @@ import com.avaje.ebean.util.CamelCaseHelper;
* .findList();
*
* }
- *
- *
+ *
*
* Note that lazy loading also works with object graphs built with RawSql.
*
- *
*/
public final class RawSql implements Serializable {
private static final long serialVersionUID = 1L;
private final ResultSet resultSet;
-
+
private final Sql sql;
private final ColumnMapping columnMapping;
@@ -192,7 +192,7 @@ public final class RawSql implements Serializable {
this.sql = null;
this.columnMapping = new ColumnMapping(propertyNames);
}
-
+
protected RawSql(ResultSet resultSet, Sql sql, ColumnMapping columnMapping) {
this.resultSet = resultSet;
this.sql = sql;
@@ -214,7 +214,7 @@ public final class RawSql implements Serializable {
String unParsedSql = (sql == null) ? "" : sql.unparsedSql;
return new Key(parsed, unParsedSql, columnMapping);
}
-
+
/**
* Return the resultSet if this is a ResultSet based RawSql.
*/
@@ -278,7 +278,7 @@ public final class RawSql implements Serializable {
* Construct for parsed SQL.
*/
protected Sql(String unparsedSql, String preFrom, String preWhere, boolean andWhereExpr,
- String preHaving, boolean andHavingExpr, String orderByPrefix, String orderBy, boolean distinct) {
+ String preHaving, boolean andHavingExpr, String orderByPrefix, String orderBy, boolean distinct) {
this.unparsedSql = unparsedSql;
this.parsed = true;
@@ -296,8 +296,7 @@ public final class RawSql implements Serializable {
if (!parsed) {
return "unparsed[" + unparsedSql + "]";
}
- return "select[" + preFrom + "] preWhere[" + preWhere + "] preHaving[" + preHaving
- + "] orderBy[" + orderBy + "]";
+ return "select[" + preFrom + "] preWhere[" + preWhere + "] preHaving[" + preHaving + "] orderBy[" + orderBy + "]";
}
public boolean isDistinct() {
@@ -386,7 +385,7 @@ public final class RawSql implements Serializable {
private final LinkedHashMap dbColumnMap;
private final Map propertyMap;
-
+
private final Map propertyColumnMap;
private final boolean parsed;
@@ -401,9 +400,8 @@ public final class RawSql implements Serializable {
this.parsed = true;
this.propertyMap = null;
this.propertyColumnMap = null;
- this.dbColumnMap = new LinkedHashMap();
- for (int i = 0; i < columns.size(); i++) {
- Column c = columns.get(i);
+ this.dbColumnMap = new LinkedHashMap<>();
+ for (Column c : columns) {
dbColumnMap.put(c.getDbColumnKey(), c);
}
}
@@ -416,9 +414,9 @@ public final class RawSql implements Serializable {
this.parsed = false;
this.propertyMap = null;
this.propertyColumnMap = null;
- this.dbColumnMap = new LinkedHashMap();
+ this.dbColumnMap = new LinkedHashMap<>();
}
-
+
/**
* Construct for ResultSet use.
*/
@@ -426,7 +424,7 @@ public final class RawSql implements Serializable {
this.immutable = false;
this.parsed = false;
this.propertyMap = null;
- this.dbColumnMap = new LinkedHashMap();
+ this.dbColumnMap = new LinkedHashMap<>();
int pos = 0;
for (String prop : propertyNames) {
@@ -443,8 +441,8 @@ public final class RawSql implements Serializable {
this.parsed = parsed;
this.dbColumnMap = dbColumnMap;
- HashMap pcMap = new HashMap();
- HashMap pMap = new HashMap();
+ HashMap pcMap = new HashMap<>();
+ HashMap pMap = new HashMap<>();
for (Column c : dbColumnMap.values()) {
pMap.put(c.getPropertyName(), c.getDbColumn());
@@ -476,9 +474,8 @@ public final class RawSql implements Serializable {
/**
* Creates an immutable copy of this ColumnMapping.
- *
- * @throws IllegalStateException
- * when a propertyName has not been defined for a column.
+ *
+ * @throws IllegalStateException when a propertyName has not been defined for a column.
*/
protected ColumnMapping createImmutableCopy() {
@@ -567,7 +564,7 @@ public final class RawSql implements Serializable {
*/
public void tableAliasMapping(String tableAlias, String path) {
- String startMatch = tableAlias+".";
+ String startMatch = tableAlias + ".";
for (Map.Entry entry : dbColumnMap.entrySet()) {
if (entry.getKey().startsWith(startMatch)) {
entry.getValue().tableAliasMapping(path);
@@ -720,8 +717,8 @@ public final class RawSql implements Serializable {
Key that = (Key) o;
return parsed == that.parsed
- && columnMapping.equals(that.columnMapping)
- && unParsedSql.equals(that.unParsedSql);
+ && columnMapping.equals(that.columnMapping)
+ && unParsedSql.equals(that.unParsedSql);
}
@Override
diff --git a/src/main/java/com/avaje/ebean/RawSqlBuilder.java b/src/main/java/com/avaje/ebean/RawSqlBuilder.java
index 45ab6880c..0c4e1ed3c 100644
--- a/src/main/java/com/avaje/ebean/RawSqlBuilder.java
+++ b/src/main/java/com/avaje/ebean/RawSqlBuilder.java
@@ -1,17 +1,17 @@
package com.avaje.ebean;
-import java.sql.ResultSet;
-
import com.avaje.ebean.RawSql.ColumnMapping;
import com.avaje.ebean.RawSql.Sql;
+import java.sql.ResultSet;
+
/**
* Builds RawSql instances from a SQL string and column mappings.
*
* Note that RawSql can also be defined in ebean-orm.xml files and be used as a
* named query.
*
- *
+ *
* @see RawSql
*/
public class RawSqlBuilder {
@@ -22,7 +22,7 @@ public class RawSqlBuilder {
public static final String IGNORE_COLUMN = "$$_IGNORE_COLUMN_$$";
private final ResultSet resultSet;
-
+
private final Sql sql;
private final ColumnMapping columnMapping;
@@ -37,7 +37,7 @@ public class RawSqlBuilder {
public static RawSql resultSet(ResultSet resultSet, String... propertyNames) {
return new RawSql(resultSet, propertyNames);
}
-
+
/**
* Return an unparsed RawSqlBuilder. Unlike a parsed one this query can not be
* modified - so no additional WHERE or HAVING expressions can be added to
@@ -70,7 +70,7 @@ public class RawSqlBuilder {
ColumnMapping mapping = DRawSqlColumnsParser.parse(select);
return new RawSqlBuilder(sql2, mapping);
}
-
+
private RawSqlBuilder(Sql sql, ColumnMapping columnMapping) {
this.sql = sql;
this.columnMapping = columnMapping;
@@ -83,11 +83,9 @@ public class RawSqlBuilder {
* For Unparsed SQL the columnMapping MUST be defined in the same order that
* the columns appear in the SQL statement.
*
- *
- * @param dbColumn
- * the DB column that we are mapping to a bean property
- * @param propertyName
- * the bean property that we are mapping the DB column to.
+ *
+ * @param dbColumn the DB column that we are mapping to a bean property
+ * @param propertyName the bean property that we are mapping the DB column to.
*/
public RawSqlBuilder columnMapping(String dbColumn, String propertyName) {
columnMapping.columnMapping(dbColumn, propertyName);
@@ -130,6 +128,4 @@ public class RawSqlBuilder {
return sql;
}
-
-
}
diff --git a/src/main/java/com/avaje/ebean/SqlQuery.java b/src/main/java/com/avaje/ebean/SqlQuery.java
index 58e4b721d..5a817bc16 100644
--- a/src/main/java/com/avaje/ebean/SqlQuery.java
+++ b/src/main/java/com/avaje/ebean/SqlQuery.java
@@ -18,23 +18,22 @@ import java.util.List;
* The returned SqlRow objects are similar to a LinkedHashMap with some type
* conversion support added.
*
- *
+ *
*
{@code
*
* // its typically a good idea to use a named query
* // and put the sql in the orm.xml instead of in your code
- *
+ *
* String sql = "select id, name from customer where name like :name and status_code = :status";
- *
+ *
* SqlQuery sqlQuery = Ebean.createSqlQuery(sql);
* sqlQuery.setParameter("name", "Acme%");
* sqlQuery.setParameter("status", "ACTIVE");
- *
+ *
* // execute the query returning a List of MapBean objects
* List list = sqlQuery.findList();
*
* }
- *
*/
public interface SqlQuery extends Serializable {
@@ -98,9 +97,8 @@ public interface SqlQuery extends Serializable {
* preparedStatement. If the timeout occurs an exception will be thrown - this
* will be a SQLException wrapped up in a PersistenceException.
*
- *
- * @param secs
- * the query timeout limit in seconds. Zero means there is no limit.
+ *
+ * @param secs the query timeout limit in seconds. Zero means there is no limit.
*/
SqlQuery setTimeout(int secs);
diff --git a/src/main/java/com/avaje/ebean/SqlUpdate.java b/src/main/java/com/avaje/ebean/SqlUpdate.java
index c02e89485..720d74159 100644
--- a/src/main/java/com/avaje/ebean/SqlUpdate.java
+++ b/src/main/java/com/avaje/ebean/SqlUpdate.java
@@ -16,19 +16,21 @@ package com.avaje.ebean;
* notify Ebean of external changes and enable Ebean to maintain it's "L2"
* server cache.
*
- *
- *
- * // example that uses 'named' parameters
- * String s = "UPDATE f_topic set post_count = :count where id = :id"
+ *
+ *
{@code
+ *
+ * // example that uses 'named' parameters
+ * String s = "UPDATE f_topic set post_count = :count where id = :id";
* SqlUpdate update = Ebean.createSqlUpdate(s);
- * update.setParameter("id", 1);
- * update.setParameter("count", 50);
- *
+ * update.setParameter("id", 1);
+ * update.setParameter("count", 50);
+ *
* int modifiedCount = Ebean.execute(update);
- *
- * String msg = "There were " + modifiedCount + " rows updated"
- *
- *
+ *
+ * String msg = "There were " + modifiedCount + " rows updated";
+ *
+ * }
+ *
* @see Update
* @see SqlQuery
* @see CallableSql
@@ -47,7 +49,7 @@ public interface SqlUpdate {
* {@link Transaction#setBatchMode(boolean)} and
* {@link Transaction#setBatchSize(int)}.
*
- *
+ *
* @see com.avaje.ebean.Ebean#execute(SqlUpdate)
*/
int execute();
diff --git a/src/main/java/com/avaje/ebean/Transaction.java b/src/main/java/com/avaje/ebean/Transaction.java
index c05434b5c..ee453f159 100644
--- a/src/main/java/com/avaje/ebean/Transaction.java
+++ b/src/main/java/com/avaje/ebean/Transaction.java
@@ -62,10 +62,10 @@ public interface Transaction extends Closeable {
*
* Functions/h3>
*
- * - Flush the JDBC batch buffer
- * - Call commit on the underlying JDBC connection
- * - Trigger any registered TransactionCallbacks
- * - Perform post-commit processing updating L2 cache, ElasticSearch etc
+ * - Flush the JDBC batch buffer
+ * - Call commit on the underlying JDBC connection
+ * - Trigger any registered TransactionCallbacks
+ * - Perform post-commit processing updating L2 cache, ElasticSearch etc
*
*/
void commitAndContinue() throws RollbackException;
@@ -78,12 +78,12 @@ public interface Transaction extends Closeable {
*
* Functions/h3>
*
- * - Flush the JDBC batch buffer
- * - Call commit on the underlying JDBC connection
- * - Trigger any registered TransactionCallbacks
- * - Perform post-commit processing updating L2 cache, ElasticSearch etc
- * - Close any underlying resources, closing the underlying JDBC connection
- * - Mark the transaction as "Inactive"
+ * - Flush the JDBC batch buffer
+ * - Call commit on the underlying JDBC connection
+ * - Trigger any registered TransactionCallbacks
+ * - Perform post-commit processing updating L2 cache, ElasticSearch etc
+ * - Close any underlying resources, closing the underlying JDBC connection
+ * - Mark the transaction as "Inactive"
*
*/
void commit() throws RollbackException;
@@ -95,10 +95,10 @@ public interface Transaction extends Closeable {
*
* Functions/h3>
*
- * - Call rollback on the underlying JDBC connection
- * - Trigger any registered TransactionCallbacks
- * - Close any underlying resources, closing the underlying JDBC connection
- * - Mark the transaction as "Inactive"
+ * - Call rollback on the underlying JDBC connection
+ * - Trigger any registered TransactionCallbacks
+ * - Close any underlying resources, closing the underlying JDBC connection
+ * - Mark the transaction as "Inactive"
*
*/
void rollback() throws PersistenceException;
@@ -136,10 +136,10 @@ public interface Transaction extends Closeable {
/**
* Set the behavior for document store updates on this transaction.
*
- * For example, set the mode to DocStoreEvent.IGNORE for this transaction and
- * then any changes via this transaction are not sent to the doc store. This
- * would be used when doing large bulk inserts into the database and we want
- * to control how that is sent to the document store.
+ * For example, set the mode to DocStoreEvent.IGNORE for this transaction and
+ * then any changes via this transaction are not sent to the doc store. This
+ * would be used when doing large bulk inserts into the database and we want
+ * to control how that is sent to the document store.
*
*/
void setDocStoreMode(DocStoreMode mode);
@@ -147,11 +147,11 @@ public interface Transaction extends Closeable {
/**
* Set the batch size to use for sending messages to the document store.
*
- * You might set this if you know the changes in this transaction result in especially large or
- * especially small payloads and want to adjust the batch size to match.
+ * You might set this if you know the changes in this transaction result in especially large or
+ * especially small payloads and want to adjust the batch size to match.
*
*
- * Setting this overrides the default of {@link DocStoreConfig#getBulkBatchSize()}
+ * Setting this overrides the default of {@link DocStoreConfig#getBulkBatchSize()}
*
*/
void setDocStoreBatchSize(int batchSize);
@@ -197,7 +197,7 @@ public interface Transaction extends Closeable {
* Refer to {@link ServerConfig#setSkipCacheAfterWrite(boolean)} for configuring the default behavior
* for using the L2 bean cache in transactions spanning multiple query/persist requests.
*
- *
+ *
*
{@code
*
* // assume Customer has L2 bean caching enabled ...
@@ -279,23 +279,23 @@ public interface Transaction extends Closeable {
*
* Example: batch processing executing every 3 rows
*
- *
+ *
*
{@code
*
* String data = "This is a simple test of the batch processing"
* + " mode and the transaction execute batch method";
- *
+ *
* String[] da = data.split(" ");
- *
+ *
* String sql = "{call sp_t3(?,?)}";
- *
+ *
* CallableSql cs = new CallableSql(sql);
* cs.registerOut(2, Types.INTEGER);
- *
+ *
* // (optional) inform eBean this stored procedure
* // inserts into a table called sp_test
* cs.addModification("sp_test", true, false, false);
- *
+ *
* Transaction txn = ebeanServer.beginTransaction();
* txn.setBatchMode(true);
* txn.setBatchSize(3);
@@ -304,16 +304,15 @@ public interface Transaction extends Closeable {
* cs.setParameter(1, da[i]);
* ebeanServer.execute(cs);
* }
- *
+ *
* // NB: commit implicitly flushes
* txn.commit();
- *
+ *
* } finally {
* txn.end();
* }
*
* }
- *
*/
void setBatchMode(boolean useBatch);
@@ -325,7 +324,6 @@ public interface Transaction extends Closeable {
*
*
* @param persistBatchMode the batch mode to use for this transaction
- *
* @see com.avaje.ebean.config.ServerConfig#setPersistBatch(com.avaje.ebean.config.PersistBatch)
*/
void setBatch(PersistBatch persistBatchMode);
@@ -347,7 +345,6 @@ public interface Transaction extends Closeable {
*
*
* @param batchOnCascadeMode the batch mode to use per save(), insert(), update() or delete()
- *
* @see com.avaje.ebean.config.ServerConfig#setPersistBatchOnCascade(com.avaje.ebean.config.PersistBatch)
*/
void setBatchOnCascade(PersistBatch batchOnCascadeMode);
diff --git a/src/main/java/com/avaje/ebean/TxCallable.java b/src/main/java/com/avaje/ebean/TxCallable.java
index 204b1774a..3e4128b7a 100644
--- a/src/main/java/com/avaje/ebean/TxCallable.java
+++ b/src/main/java/com/avaje/ebean/TxCallable.java
@@ -12,24 +12,26 @@ package com.avaje.ebean;
*
* See also {@link TxRunnable}.
*
- *
- *
- * Ebean.execute(new TxCallable<String>() {
+ *
+ *
{@code
+ *
+ * Ebean.execute(new TxCallable() {
* public String call() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
- *
- * u1.setName("u1 mod");
- * u2.setName("u2 mod");
- *
+ *
+ * u1.setName("u1 mod");
+ * u2.setName("u2 mod");
+ *
* Ebean.save(u1);
* Ebean.save(u2);
- *
+ *
* return u1.getEmail();
* }
* });
- *
- *
+ *
+ * }
+ *
* @see TxRunnable
*/
public interface TxCallable {
diff --git a/src/main/java/com/avaje/ebean/TxIsolation.java b/src/main/java/com/avaje/ebean/TxIsolation.java
index 8c0394c29..754959bbf 100644
--- a/src/main/java/com/avaje/ebean/TxIsolation.java
+++ b/src/main/java/com/avaje/ebean/TxIsolation.java
@@ -12,7 +12,7 @@ import java.sql.Connection;
* This can be used with TxScope to define transactional scopes to execute
* method within.
*
- *
+ *
* @see TxScope
*/
public enum TxIsolation {
@@ -74,26 +74,26 @@ public enum TxIsolation {
public static TxIsolation fromLevel(int connectionIsolationLevel) {
switch (connectionIsolationLevel) {
- case Connection.TRANSACTION_READ_UNCOMMITTED:
- return TxIsolation.READ_UNCOMMITTED;
+ case Connection.TRANSACTION_READ_UNCOMMITTED:
+ return TxIsolation.READ_UNCOMMITTED;
- case Connection.TRANSACTION_READ_COMMITTED:
- return TxIsolation.READ_COMMITED;
+ case Connection.TRANSACTION_READ_COMMITTED:
+ return TxIsolation.READ_COMMITED;
- case Connection.TRANSACTION_REPEATABLE_READ:
- return TxIsolation.REPEATABLE_READ;
+ case Connection.TRANSACTION_REPEATABLE_READ:
+ return TxIsolation.REPEATABLE_READ;
- case Connection.TRANSACTION_SERIALIZABLE:
- return TxIsolation.SERIALIZABLE;
+ case Connection.TRANSACTION_SERIALIZABLE:
+ return TxIsolation.SERIALIZABLE;
- case Connection.TRANSACTION_NONE:
- return TxIsolation.NONE;
+ case Connection.TRANSACTION_NONE:
+ return TxIsolation.NONE;
- case -1:
- return TxIsolation.DEFAULT;
+ case -1:
+ return TxIsolation.DEFAULT;
- default:
- throw new RuntimeException("Unknown isolation level " + connectionIsolationLevel);
+ default:
+ throw new RuntimeException("Unknown isolation level " + connectionIsolationLevel);
}
}
diff --git a/src/main/java/com/avaje/ebean/TxRunnable.java b/src/main/java/com/avaje/ebean/TxRunnable.java
index f3bc724cc..2ae3009a2 100644
--- a/src/main/java/com/avaje/ebean/TxRunnable.java
+++ b/src/main/java/com/avaje/ebean/TxRunnable.java
@@ -8,26 +8,27 @@ package com.avaje.ebean;
*
* See also {@link TxCallable}.
*
- *
- *
- *
+ *
+ *
{@code
+ *
* // this run method runs in a transaction scope
* // which by default is TxScope.REQUIRED
- *
+ *
* Ebean.execute(new TxRunnable() {
* public void run() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
- *
- * u1.setName("u1 mod");
- * u2.setName("u2 mod");
- *
+ *
+ * u1.setName("u1 mod");
+ * u2.setName("u2 mod");
+ *
* Ebean.save(u1);
* Ebean.save(u2);
* }
* });
- *
- *
+ *
+ * }
+ *
* @see TxCallable
*/
public interface TxRunnable {
diff --git a/src/main/java/com/avaje/ebean/TxScope.java b/src/main/java/com/avaje/ebean/TxScope.java
index 0811f63b5..300e7b696 100644
--- a/src/main/java/com/avaje/ebean/TxScope.java
+++ b/src/main/java/com/avaje/ebean/TxScope.java
@@ -105,8 +105,7 @@ public final class TxScope {
*/
public String toString() {
return "TxScope[" + type + "] readOnly[" + readOnly + "] isolation[" + isolation
- + "] serverName[" + serverName
- + "] rollbackFor[" + rollbackFor + "] noRollbackFor[" + noRollbackFor + "]";
+ + "] serverName[" + serverName + "] rollbackFor[" + rollbackFor + "] noRollbackFor[" + noRollbackFor + "]";
}
/**
@@ -282,7 +281,7 @@ public final class TxScope {
*/
public TxScope setRollbackFor(Class extends Throwable> rollbackThrowable) {
if (rollbackFor == null) {
- rollbackFor = new ArrayList>(2);
+ rollbackFor = new ArrayList<>(2);
}
rollbackFor.add(rollbackThrowable);
return this;
@@ -294,10 +293,10 @@ public final class TxScope {
@SuppressWarnings("unchecked")
public TxScope setRollbackFor(Class>[] rollbackThrowables) {
if (rollbackFor == null) {
- rollbackFor = new ArrayList>(rollbackThrowables.length);
+ rollbackFor = new ArrayList<>(rollbackThrowables.length);
}
- for (int i = 0; i < rollbackThrowables.length; i++) {
- rollbackFor.add((Class extends Throwable>) rollbackThrowables[i]);
+ for (Class> rollbackThrowable : rollbackThrowables) {
+ rollbackFor.add((Class extends Throwable>) rollbackThrowable);
}
return this;
}
@@ -316,7 +315,7 @@ public final class TxScope {
*/
public TxScope setNoRollbackFor(Class extends Throwable> noRollback) {
if (noRollbackFor == null) {
- noRollbackFor = new ArrayList>(2);
+ noRollbackFor = new ArrayList<>(2);
}
this.noRollbackFor.add(noRollback);
return this;
@@ -328,10 +327,10 @@ public final class TxScope {
@SuppressWarnings("unchecked")
public TxScope setNoRollbackFor(Class>[] noRollbacks) {
if (noRollbackFor == null) {
- noRollbackFor = new ArrayList>(noRollbacks.length);
+ noRollbackFor = new ArrayList<>(noRollbacks.length);
}
- for (int i = 0; i < noRollbacks.length; i++) {
- noRollbackFor.add((Class extends Throwable>) noRollbacks[i]);
+ for (Class> noRollback : noRollbacks) {
+ noRollbackFor.add((Class extends Throwable>) noRollback);
}
return this;
}
diff --git a/src/main/java/com/avaje/ebean/TxType.java b/src/main/java/com/avaje/ebean/TxType.java
index e1cb19511..08d724d24 100644
--- a/src/main/java/com/avaje/ebean/TxType.java
+++ b/src/main/java/com/avaje/ebean/TxType.java
@@ -8,7 +8,7 @@ package com.avaje.ebean;
* {@link Ebean#execute(TxScope, TxCallable)} and
* {@link Ebean#execute(TxScope, TxRunnable)}.
*
- *
+ *
* @see TxScope
*/
public enum TxType {
diff --git a/src/main/java/com/avaje/ebean/Update.java b/src/main/java/com/avaje/ebean/Update.java
index d58fb8575..cbebb6c2c 100644
--- a/src/main/java/com/avaje/ebean/Update.java
+++ b/src/main/java/com/avaje/ebean/Update.java
@@ -11,43 +11,43 @@ package com.avaje.ebean;
*
* The following is an example of named updates on an entity bean.
*
- *
- *
+ * {@code
* ...
- * @NamedUpdates(value = {
- * @NamedUpdate(
- * name = "setTitle",
- * notifyCache = false,
- * update = "update topic set title = :title, postCount = :count where id = :id"),
- * @NamedUpdate(
- * name = "setPostCount",
- * notifyCache = false,
- * update = "update f_topic set post_count = :postCount where id = :id"),
- * @NamedUpdate(
- * name = "incrementPostCount",
- * notifyCache = false,
- * update = "update Topic set postCount = postCount + 1 where id = :id")
- * //update = "update f_topic set post_count = post_count + 1 where id = :id")
+ * @NamedUpdates(value = {
+ * @NamedUpdate(
+ * name = "setTitle",
+ * notifyCache = false,
+ * update = "update topic set title = :title, postCount = :count where id = :id"),
+ * @NamedUpdate(
+ * name = "setPostCount",
+ * notifyCache = false,
+ * update = "update f_topic set post_count = :postCount where id = :id"),
+ * @NamedUpdate(
+ * name = "incrementPostCount",
+ * notifyCache = false,
+ * update = "update Topic set postCount = postCount + 1 where id = :id")
+ * //update = "update f_topic set post_count = post_count + 1 where id = :id")
* })
- * @Entity
- * @Table(name = "f_topic")
+ * @Entity
+ * @Table(name = "f_topic")
* public class Topic {
* ...
- *
- *
+ * }
+ *
*
* The following show code that would use a named update on the Topic entity
* bean.
*
- *
- *
- * Update<Topic> update = Ebean.createUpdate(Topic.class, "incrementPostCount");
- * update.setParameter("id", 1);
+ *
+ *
{@code
+ *
+ * Update update = Ebean.createUpdate(Topic.class, "incrementPostCount");
+ * update.setParameter("id", 1);
* int rows = update.execute();
- *
- *
- * @param
- * the type of entity beans inserted updated or deleted
+ *
+ * }
+ *
+ * @param the type of entity beans inserted updated or deleted
*/
public interface Update {
@@ -73,9 +73,8 @@ public interface Update {
* preparedStatement. If the timeout occurs an exception will be thrown - this
* will be a SQLException wrapped up in a PersistenceException.
*
- *
- * @param secs
- * the timeout in seconds. Zero implies unlimited.
+ *
+ * @param secs the timeout in seconds. Zero implies unlimited.
*/
Update setTimeout(int secs);
@@ -92,21 +91,17 @@ public interface Update {
*
* Set a value for each ? you have in the sql.
*
- *
- * @param position
- * the index position of the parameter starting with 1.
- * @param value
- * the parameter value to bind.
+ *
+ * @param position the index position of the parameter starting with 1.
+ * @param value the parameter value to bind.
*/
Update set(int position, Object value);
/**
* Set and ordered bind parameter (same as bind).
- *
- * @param position
- * the index position of the parameter starting with 1.
- * @param value
- * the parameter value to bind.
+ *
+ * @param position the index position of the parameter starting with 1.
+ * @param value the parameter value to bind.
*/
Update setParameter(int position, Object value);
@@ -129,11 +124,9 @@ public interface Update {
*
* A more succinct version of setParameter() to be consistent with Query.
*
- *
- * @param name
- * the parameter name.
- * @param value
- * the parameter value.
+ *
+ * @param name the parameter name.
+ * @param value the parameter value.
*/
Update set(String name, Object value);
@@ -148,11 +141,9 @@ public interface Update {
*
* A more succinct version of setNullParameter().
*
- *
- * @param name
- * the parameter name.
- * @param jdbcType
- * the type of the property being bound.
+ *
+ * @param name the parameter name.
+ * @param jdbcType the type of the property being bound.
*/
Update setNull(String name, int jdbcType);
@@ -166,4 +157,4 @@ public interface Update {
*/
String getGeneratedSql();
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/UpdateQuery.java b/src/main/java/com/avaje/ebean/UpdateQuery.java
index 3760d57f6..1245644cd 100644
--- a/src/main/java/com/avaje/ebean/UpdateQuery.java
+++ b/src/main/java/com/avaje/ebean/UpdateQuery.java
@@ -7,9 +7,9 @@ package com.avaje.ebean;
* This UpdateQuery is more for the cases where we want to build the where expression of the update using the
* {@link ExpressionList} "Criteria API" that is used with a normal ORM query.
*
- *
+ *
*
Example: Simple update
- *
+ *
*
{@code
*
* int rows = ebeanServer
@@ -26,18 +26,17 @@ package com.avaje.ebean;
* update o_customer set status=?, updtime=? where id > ?
*
* }
- *
*
* Note that if the where() clause contains a join then the SQL update changes to use a
* WHERE ID IN () form.
*
- *
+ *
*
Example: Update with a JOIN
*
- * In this example the expression .eq("billingAddress.country", nz) requires a join
- * to the address table.
+ * In this example the expression .eq("billingAddress.country", nz) requires a join
+ * to the address table.
*
- *
+ *
*
{@code
*
* int rows = ebeanServer
@@ -50,7 +49,7 @@ package com.avaje.ebean;
* .gt("id", 1000)
* .update();
* }
- *
+ *
*
{@code sql
*
* update o_customer set status=?, updtime=?
@@ -65,15 +64,13 @@ package com.avaje.ebean;
* }
*
* @param The type of entity bean being updated
- *
* @see SqlUpdate
*/
public interface UpdateQuery {
/**
* Set the value of a property.
- *
- *
+ *
*
{@code
*
* int rows = ebeanServer
@@ -87,13 +84,13 @@ public interface UpdateQuery {
* }
*
* @param property The bean property to be set
- * @param value The value to set the property to
+ * @param value The value to set the property to
*/
UpdateQuery set(String property, Object value);
/**
* Set the property to be null.
- *
+ *
*
{@code
*
* int rows = ebeanServer
@@ -110,12 +107,11 @@ public interface UpdateQuery {
UpdateQuery setNull(String property);
/**
- *
* Set using a property expression that does not need any bind values.
*
* The property expression typically contains database functions.
*
- *
+ *
*
{@code
*
* int rows = ebeanServer
@@ -148,7 +144,7 @@ public interface UpdateQuery {
* }
*
* @param propertyExpression A raw property expression
- * @param values The values to bind with the property expression
+ * @param values The values to bind with the property expression
*/
UpdateQuery setRaw(String propertyExpression, Object... values);
diff --git a/src/main/java/com/avaje/ebean/ValuePair.java b/src/main/java/com/avaje/ebean/ValuePair.java
index e9a49eb75..8b3480449 100644
--- a/src/main/java/com/avaje/ebean/ValuePair.java
+++ b/src/main/java/com/avaje/ebean/ValuePair.java
@@ -29,7 +29,7 @@ public class ValuePair {
public Object getNewValue() {
return newValue;
}
-
+
/**
* Return the old value.
*/
diff --git a/src/main/java/com/avaje/ebean/annotation/Aggregation.java b/src/main/java/com/avaje/ebean/annotation/Aggregation.java
index 7fb6589cc..aeb4147c1 100644
--- a/src/main/java/com/avaje/ebean/annotation/Aggregation.java
+++ b/src/main/java/com/avaje/ebean/annotation/Aggregation.java
@@ -13,7 +13,7 @@ import java.lang.annotation.Target;
* included in a query. To populate the aggregation property it must be
* explicitly included in the select().
*
- *
+ *
*
Example:
* {@code
*
@@ -24,7 +24,7 @@ import java.lang.annotation.Target;
* Long totalAmount;
*
* }
- *
+ *
*
Example query
* {@code
*
diff --git a/src/main/java/com/avaje/ebean/annotation/Cache.java b/src/main/java/com/avaje/ebean/annotation/Cache.java
index ea1a50f2a..59be62ef3 100644
--- a/src/main/java/com/avaje/ebean/annotation/Cache.java
+++ b/src/main/java/com/avaje/ebean/annotation/Cache.java
@@ -8,7 +8,7 @@ import java.lang.annotation.Target;
/**
* Specify the default cache use specific entity type.
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Cache {
diff --git a/src/main/java/com/avaje/ebean/annotation/CacheBeanTuning.java b/src/main/java/com/avaje/ebean/annotation/CacheBeanTuning.java
index 546f50d5f..b1a299f51 100644
--- a/src/main/java/com/avaje/ebean/annotation/CacheBeanTuning.java
+++ b/src/main/java/com/avaje/ebean/annotation/CacheBeanTuning.java
@@ -12,7 +12,7 @@ import java.lang.annotation.Target;
* ElasticSearch, Hazelcast, Ignite etc.
*
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface CacheBeanTuning {
diff --git a/src/main/java/com/avaje/ebean/annotation/CacheQueryTuning.java b/src/main/java/com/avaje/ebean/annotation/CacheQueryTuning.java
index 2fd1464e5..bf43ef9fc 100644
--- a/src/main/java/com/avaje/ebean/annotation/CacheQueryTuning.java
+++ b/src/main/java/com/avaje/ebean/annotation/CacheQueryTuning.java
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
* If this is not specified then the system default settings are used.
*
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface CacheQueryTuning {
diff --git a/src/main/java/com/avaje/ebean/annotation/CreatedTimestamp.java b/src/main/java/com/avaje/ebean/annotation/CreatedTimestamp.java
index 49b5bc6a1..d53e62baf 100644
--- a/src/main/java/com/avaje/ebean/annotation/CreatedTimestamp.java
+++ b/src/main/java/com/avaje/ebean/annotation/CreatedTimestamp.java
@@ -22,7 +22,7 @@ import java.lang.annotation.Target;
* timestamp value after the insert has occurred. You need to fetch the entity
* back to get the inserted timestamp if you want to used it.
*
- *
+ *
*
Example:
* {@code
*
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
*
* }
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface CreatedTimestamp {
diff --git a/src/main/java/com/avaje/ebean/annotation/DbArray.java b/src/main/java/com/avaje/ebean/annotation/DbArray.java
index 5c81651d5..8d3fd5d24 100644
--- a/src/main/java/com/avaje/ebean/annotation/DbArray.java
+++ b/src/main/java/com/avaje/ebean/annotation/DbArray.java
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
* If the target database does not support ARRAY type (so not Postgres)
* then the collection will be stored in JSON format into a VARCHAR column.
*
- *
+ *
*
Example:
* {@code
*
diff --git a/src/main/java/com/avaje/ebean/annotation/DbHstore.java b/src/main/java/com/avaje/ebean/annotation/DbHstore.java
index 9ffd29760..87ede7183 100644
--- a/src/main/java/com/avaje/ebean/annotation/DbHstore.java
+++ b/src/main/java/com/avaje/ebean/annotation/DbHstore.java
@@ -10,7 +10,7 @@ import java.lang.annotation.Target;
*
* The Map property should have keys and values of type String.
*
- *
+ *
*
Example:
* {@code
*
@@ -27,4 +27,4 @@ public @interface DbHstore {
* For VARCHAR storage specify the column length (defaults to 1000).
*/
int length() default 0;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/annotation/DbJson.java b/src/main/java/com/avaje/ebean/annotation/DbJson.java
index d5bf2b059..07cf1564e 100644
--- a/src/main/java/com/avaje/ebean/annotation/DbJson.java
+++ b/src/main/java/com/avaje/ebean/annotation/DbJson.java
@@ -18,7 +18,7 @@ import java.lang.annotation.Target;
* Map content;
*
* }
- *
+ *
*
Example with JSONB storage
* {@code
*
@@ -41,4 +41,4 @@ public @interface DbJson {
* For VARCHAR storage specify the column length (defaults to 3000).
*/
int length() default 0;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/annotation/DbJsonB.java b/src/main/java/com/avaje/ebean/annotation/DbJsonB.java
index ebfaf9270..418294006 100644
--- a/src/main/java/com/avaje/ebean/annotation/DbJsonB.java
+++ b/src/main/java/com/avaje/ebean/annotation/DbJsonB.java
@@ -11,9 +11,9 @@ import java.lang.annotation.Target;
* The content will be stored on Postgres using it's JSONB type and as Clob for other databases.
*
*
- * This is equivalent to using @DbJson(storage = DbJsonType.JSONB)
+ * This is equivalent to using @DbJson(storage = DbJsonType.JSONB)
*
- *
+ *
*
Example:
* {@code
*
@@ -22,7 +22,7 @@ import java.lang.annotation.Target;
* Map content;
*
* }
- *
+ *
*
Equivalent to:
* {@code
*
@@ -40,4 +40,4 @@ public @interface DbJsonB {
* For VARCHAR storage specify the column length.
*/
int length() default 0;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/annotation/DocEmbedded.java b/src/main/java/com/avaje/ebean/annotation/DocEmbedded.java
index f0e258287..5cfd92ce7 100644
--- a/src/main/java/com/avaje/ebean/annotation/DocEmbedded.java
+++ b/src/main/java/com/avaje/ebean/annotation/DocEmbedded.java
@@ -7,7 +7,6 @@ import java.lang.annotation.Target;
/**
* Specify the property is included in the parent document store index.
- *
* {@code
*
*
@@ -25,7 +24,7 @@ import java.lang.annotation.Target;
*
* }
*/
-@Target({ ElementType.FIELD })
+@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DocEmbedded {
diff --git a/src/main/java/com/avaje/ebean/annotation/DocMapping.java b/src/main/java/com/avaje/ebean/annotation/DocMapping.java
index b95a1ec74..10c1fc857 100644
--- a/src/main/java/com/avaje/ebean/annotation/DocMapping.java
+++ b/src/main/java/com/avaje/ebean/annotation/DocMapping.java
@@ -8,7 +8,7 @@ import java.lang.annotation.Target;
/**
* Specify the entity type maps to a document store (like ElasticSearch).
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface DocMapping {
diff --git a/src/main/java/com/avaje/ebean/annotation/DocProperty.java b/src/main/java/com/avaje/ebean/annotation/DocProperty.java
index 4cc5ad262..ee4aaa21b 100644
--- a/src/main/java/com/avaje/ebean/annotation/DocProperty.java
+++ b/src/main/java/com/avaje/ebean/annotation/DocProperty.java
@@ -8,7 +8,7 @@ import java.lang.annotation.Target;
/**
* Specify the entity type maps to a document store (like ElasticSearch).
*/
-@Target({ ElementType.FIELD })
+@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DocProperty {
diff --git a/src/main/java/com/avaje/ebean/annotation/DocSortable.java b/src/main/java/com/avaje/ebean/annotation/DocSortable.java
index f0b87b450..ba554c1c5 100644
--- a/src/main/java/com/avaje/ebean/annotation/DocSortable.java
+++ b/src/main/java/com/avaje/ebean/annotation/DocSortable.java
@@ -13,7 +13,7 @@ import java.lang.annotation.Target;
* For example, customer name and product name are good candidates for marking with @DocSortable.
*
*/
-@Target({ ElementType.FIELD })
+@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DocSortable {
diff --git a/src/main/java/com/avaje/ebean/annotation/DocStore.java b/src/main/java/com/avaje/ebean/annotation/DocStore.java
index be116b799..808c35977 100644
--- a/src/main/java/com/avaje/ebean/annotation/DocStore.java
+++ b/src/main/java/com/avaje/ebean/annotation/DocStore.java
@@ -8,7 +8,7 @@ import java.lang.annotation.Target;
/**
* Specify the entity type maps to a document store (like ElasticSearch).
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface DocStore {
@@ -73,7 +73,6 @@ public @interface DocStore {
* Note that typically DocStoreEmbedded is used on @ManyToOne and @OneToMany
* properties to indicate what part of the nested document should be included.
*
- *
* Example:
* {@code
*
diff --git a/src/main/java/com/avaje/ebean/annotation/DocStoreMode.java b/src/main/java/com/avaje/ebean/annotation/DocStoreMode.java
index b4805ee75..03297dbc6 100644
--- a/src/main/java/com/avaje/ebean/annotation/DocStoreMode.java
+++ b/src/main/java/com/avaje/ebean/annotation/DocStoreMode.java
@@ -23,9 +23,9 @@ public enum DocStoreMode {
/**
* Ignore the event and not update the document store.
*
- * This can be used on a index or for a transaction where you want to have more
- * manual programmatic control over the updating of the document store. Say you want to
- * IGNORE on a particular transaction and instead manually queue a bulk update.
+ * This can be used on a index or for a transaction where you want to have more
+ * manual programmatic control over the updating of the document store. Say you want to
+ * IGNORE on a particular transaction and instead manually queue a bulk update.
*
*/
IGNORE,
diff --git a/src/main/java/com/avaje/ebean/annotation/EmbeddedColumns.java b/src/main/java/com/avaje/ebean/annotation/EmbeddedColumns.java
index 5a68edbac..b63ecfebf 100644
--- a/src/main/java/com/avaje/ebean/annotation/EmbeddedColumns.java
+++ b/src/main/java/com/avaje/ebean/annotation/EmbeddedColumns.java
@@ -12,7 +12,7 @@ import java.lang.annotation.Target;
* standard JPA.
*
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface EmbeddedColumns {
diff --git a/src/main/java/com/avaje/ebean/annotation/Encrypted.java b/src/main/java/com/avaje/ebean/annotation/Encrypted.java
index a803ddc0a..25c1697c0 100644
--- a/src/main/java/com/avaje/ebean/annotation/Encrypted.java
+++ b/src/main/java/com/avaje/ebean/annotation/Encrypted.java
@@ -8,7 +8,7 @@ import java.lang.annotation.Target;
/**
* Specify that the property is stored in encrypted form.
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Encrypted {
diff --git a/src/main/java/com/avaje/ebean/annotation/EnumValue.java b/src/main/java/com/avaje/ebean/annotation/EnumValue.java
index 8dce61fdc..d34294327 100644
--- a/src/main/java/com/avaje/ebean/annotation/EnumValue.java
+++ b/src/main/java/com/avaje/ebean/annotation/EnumValue.java
@@ -7,21 +7,20 @@ import java.lang.annotation.Target;
/**
* Enables you to specify a value to use to persist for an enum value.
- *
* {@code
*
* public enum Status {
*
* @EnumValue("N")
* NEW,
- *
+ *
* @EnumValue("A")
* ACTIVE,
- *
+ *
* @EnumValue("I")
* INACTIVE,
* }
- *
+ *
* }
*
* This is an alternative to using the JPA standard approach or Ebean's
@@ -33,7 +32,7 @@ import java.lang.annotation.Target;
* and fetched as strings.
*
*/
-@Target({ ElementType.FIELD })
+@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface EnumValue {
diff --git a/src/main/java/com/avaje/ebean/annotation/Formula.java b/src/main/java/com/avaje/ebean/annotation/Formula.java
index e0b9cb682..f53de86ee 100644
--- a/src/main/java/com/avaje/ebean/annotation/Formula.java
+++ b/src/main/java/com/avaje/ebean/annotation/Formula.java
@@ -1,14 +1,14 @@
package com.avaje.ebean.annotation;
+import com.avaje.ebean.Query;
+import com.avaje.ebean.config.dbplatform.DatabasePlatform;
+
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import com.avaje.ebean.Query;
-import com.avaje.ebean.config.dbplatform.DatabasePlatform;
-
/**
* Assign to a property to be based on a SQL formula.
*
@@ -26,28 +26,27 @@ import com.avaje.ebean.config.dbplatform.DatabasePlatform;
* You may want to do this if the Formula is relatively expensive and only want
* it included in the query when you explicitly state it.
*
- *
- *
- * // On the Order "master" bean
+ *
+ *
{@code
+ * // On the Order "master" bean
* // ... a formula using the Order details
* // ... sum(order_qty*unit_price)
- * @Transient
- * @Formula(select = "_b${ta}.total_amount", join = "join (select order_id, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) as _b${ta} on _b${ta}.order_id = ${ta}.id")
+ * @Transient
+ * @Formula(select = "_b${ta}.total_amount", join = "join (select order_id, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id) as _b${ta} on _b${ta}.order_id = ${ta}.id")
* Double totalAmount;
- *
- *
+ *
+ * }
*
* As the totalAmount formula is also Transient it is not included by default in
* queries - it needs to be explicitly included.
*
- *
* {@code
*
* // find by Id
* Order o1 = Ebean.find(Order.class)
* .select("id, totalAmount")
* .setId(1).findUnique();
- *
+ *
* // find list ... using totalAmount in the where clause
* List list = Ebean.find(Order.class)
* .select("id, totalAmount")
@@ -55,7 +54,7 @@ import com.avaje.ebean.config.dbplatform.DatabasePlatform;
* .eq("status", Order.Status.NEW)
* .gt("totalAmount", 10)
* .findList();
- *
+ *
* // as a join from customer
* List l0 = Ebean.find(Customer.class)
* .select("id, name")
@@ -64,10 +63,10 @@ import com.avaje.ebean.config.dbplatform.DatabasePlatform;
* .gt("id", 0)
* .gt("orders.totalAmount", 10)
* .findList();
- *
+ *
* }
*/
-@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Formula.List.class)
public @interface Formula {
@@ -87,7 +86,6 @@ public @interface Formula {
*
* The join string should start with either "left join" or "join".
*
- *
*
* You will almost certainly use the "${ta}" as a place holder for the table
* alias of the table you are joining back to (the "base table" of the entity
@@ -97,7 +95,7 @@ public @interface Formula {
* The example below is used to support a total count of topics created by a
* user.
*
- *
+ *
*
{@code
*
* join (select user_id, count(*) as topic_count from f_topic group by user_id) as _tc on _tc.user_id = ${ta}.id
diff --git a/src/main/java/com/avaje/ebean/annotation/History.java b/src/main/java/com/avaje/ebean/annotation/History.java
index 36888086d..9548b3cf1 100644
--- a/src/main/java/com/avaje/ebean/annotation/History.java
+++ b/src/main/java/com/avaje/ebean/annotation/History.java
@@ -12,7 +12,7 @@ import java.lang.annotation.Target;
* typically automatically populated via database triggers.
*
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface History {
diff --git a/src/main/java/com/avaje/ebean/annotation/HistoryExclude.java b/src/main/java/com/avaje/ebean/annotation/HistoryExclude.java
index a41dfe1d9..bae53aa35 100644
--- a/src/main/java/com/avaje/ebean/annotation/HistoryExclude.java
+++ b/src/main/java/com/avaje/ebean/annotation/HistoryExclude.java
@@ -18,7 +18,7 @@ import java.lang.annotation.Target;
* support.
*
*/
-@Target({ ElementType.FIELD })
+@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface HistoryExclude {
diff --git a/src/main/java/com/avaje/ebean/annotation/Index.java b/src/main/java/com/avaje/ebean/annotation/Index.java
index ae82a8802..426320f5f 100644
--- a/src/main/java/com/avaje/ebean/annotation/Index.java
+++ b/src/main/java/com/avaje/ebean/annotation/Index.java
@@ -29,7 +29,7 @@ public @interface Index {
/**
* When placed on the class (rather than field) you can specify the columns
* to include in the index in order.
- *
+ *
* Wnen placed on a field, and columnNames are specified, the field-column has to be included.
* You can use "${fa}" for alias
*/
diff --git a/src/main/java/com/avaje/ebean/annotation/Indices.java b/src/main/java/com/avaje/ebean/annotation/Indices.java
index 0886482ed..0e74559f7 100644
--- a/src/main/java/com/avaje/ebean/annotation/Indices.java
+++ b/src/main/java/com/avaje/ebean/annotation/Indices.java
@@ -4,9 +4,10 @@ import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+
/**
* An annotation for declaring multiple indices at class or field level.
- *
+ *
* @author Roland Praml, FOCONIS AG
*/
@Target({ElementType.TYPE, ElementType.FIELD})
diff --git a/src/main/java/com/avaje/ebean/annotation/JsonIgnore.java b/src/main/java/com/avaje/ebean/annotation/JsonIgnore.java
index 79635ddc1..822882a0c 100644
--- a/src/main/java/com/avaje/ebean/annotation/JsonIgnore.java
+++ b/src/main/java/com/avaje/ebean/annotation/JsonIgnore.java
@@ -8,8 +8,8 @@ import java.lang.annotation.Target;
/**
* Similar to Jackson JsonIgnore but provides the option to just ignore serialize or deserialize.
*
- * This provides the same features as Expose but from the opposite perspective which is probably
- * more common and more familiar to Jackson users.
+ * This provides the same features as Expose but from the opposite perspective which is probably
+ * more common and more familiar to Jackson users.
*
*/
@Retention(RetentionPolicy.RUNTIME)
@@ -29,4 +29,4 @@ public @interface JsonIgnore {
* Defaults to {@code false}.
*/
boolean deserialize() default false;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/avaje/ebean/annotation/PrivateOwned.java b/src/main/java/com/avaje/ebean/annotation/PrivateOwned.java
index 684f5a416..a7d58f978 100644
--- a/src/main/java/com/avaje/ebean/annotation/PrivateOwned.java
+++ b/src/main/java/com/avaje/ebean/annotation/PrivateOwned.java
@@ -18,7 +18,7 @@ import java.lang.annotation.Target;
* in that they are no longer associated/linked to their parent bean.
*
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PrivateOwned {
diff --git a/src/main/java/com/avaje/ebean/annotation/Sql.java b/src/main/java/com/avaje/ebean/annotation/Sql.java
index 223db95c5..a37c70d96 100644
--- a/src/main/java/com/avaje/ebean/annotation/Sql.java
+++ b/src/main/java/com/avaje/ebean/annotation/Sql.java
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
* This means the entity bean has no base table specified (via @Table).
*
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Sql {
diff --git a/src/main/java/com/avaje/ebean/annotation/Transactional.java b/src/main/java/com/avaje/ebean/annotation/Transactional.java
index 5de7f8b6c..db998ad94 100644
--- a/src/main/java/com/avaje/ebean/annotation/Transactional.java
+++ b/src/main/java/com/avaje/ebean/annotation/Transactional.java
@@ -1,14 +1,14 @@
package com.avaje.ebean.annotation;
+import com.avaje.ebean.TxIsolation;
+import com.avaje.ebean.TxType;
+import com.avaje.ebean.config.PersistBatch;
+
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import com.avaje.ebean.TxIsolation;
-import com.avaje.ebean.TxType;
-import com.avaje.ebean.config.PersistBatch;
-
/**
* Specify transaction scoping for a method.
*
@@ -33,22 +33,22 @@ import com.avaje.ebean.config.PersistBatch;
* to set the default behaviour to rollback on any exception and optionally
* change the setting to be consistent with EJB/Spring if people wish to do so.
*
- *
+ *
*
{@code
*
* // a normal class
* public class MySimpleUserService {
- *
+ *
* // this method is transactional automatically handling
* // transaction begin, commit and rollback etc
* @Transactional
* public void runInTrans() throws IOException {
- *
+ *
* // tasks performed within the transaction
* ...
* // find some objects
* Customer cust = ebeanServer.find(Customer.class, 42);
- *
+ *
* Order order = ...;
* ...
* // save some objects
@@ -58,7 +58,7 @@ import com.avaje.ebean.config.PersistBatch;
*
* }
*/
-@Target({ ElementType.METHOD, ElementType.TYPE })
+@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Transactional {
diff --git a/src/main/java/com/avaje/ebean/annotation/UpdateMode.java b/src/main/java/com/avaje/ebean/annotation/UpdateMode.java
index f051262a8..0353737bc 100644
--- a/src/main/java/com/avaje/ebean/annotation/UpdateMode.java
+++ b/src/main/java/com/avaje/ebean/annotation/UpdateMode.java
@@ -14,13 +14,13 @@ import java.lang.annotation.Target;
*
* Note that the default can be set via ebean.properties.
*
- *
+ *
*
* ## Set to update all loaded properties
* ebean.updateChangesOnly=false
*
*/
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface UpdateMode {
diff --git a/src/main/java/com/avaje/ebean/annotation/UpdatedTimestamp.java b/src/main/java/com/avaje/ebean/annotation/UpdatedTimestamp.java
index b93a5ab37..8a181369e 100644
--- a/src/main/java/com/avaje/ebean/annotation/UpdatedTimestamp.java
+++ b/src/main/java/com/avaje/ebean/annotation/UpdatedTimestamp.java
@@ -13,7 +13,7 @@ import java.lang.annotation.Target;
* towards a better naming convention (WhenCreated, WhenModified).
*
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface UpdatedTimestamp {
diff --git a/src/main/java/com/avaje/ebean/annotation/WhenCreated.java b/src/main/java/com/avaje/ebean/annotation/WhenCreated.java
index 0d20fdc7a..6779254d1 100644
--- a/src/main/java/com/avaje/ebean/annotation/WhenCreated.java
+++ b/src/main/java/com/avaje/ebean/annotation/WhenCreated.java
@@ -22,7 +22,7 @@ import java.lang.annotation.Target;
* timestamp value after the insert has occurred. You need to fetch the entity
* back to get the inserted timestamp if you want to used it.
*
- *
+ *
*
Example:
* {@code
*
@@ -31,7 +31,7 @@ import java.lang.annotation.Target;
*
* }
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface WhenCreated {
diff --git a/src/main/java/com/avaje/ebean/annotation/WhenModified.java b/src/main/java/com/avaje/ebean/annotation/WhenModified.java
index 1dbfd674e..3e9838816 100644
--- a/src/main/java/com/avaje/ebean/annotation/WhenModified.java
+++ b/src/main/java/com/avaje/ebean/annotation/WhenModified.java
@@ -12,7 +12,7 @@ import java.lang.annotation.Target;
* towards a better naming convention (WhenCreated, WhenModified).
*
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface WhenModified {
diff --git a/src/main/java/com/avaje/ebean/annotation/Where.java b/src/main/java/com/avaje/ebean/annotation/Where.java
index 2c9ccf03a..b73e81100 100644
--- a/src/main/java/com/avaje/ebean/annotation/Where.java
+++ b/src/main/java/com/avaje/ebean/annotation/Where.java
@@ -11,37 +11,33 @@ import com.avaje.ebean.config.dbplatform.DatabasePlatform;
/**
* Add an Literal to add to the where clause when a many property (List, Set or
* Map) is loaded or refreshed.
- *
* {@code
*
* // on a OneToMany property...
- *
+ *
* @OneToMany
* @Where(clause = "deleted='y'")
* List topics;
*
* }
- *
*
* Note that you can include "${ta}" as a place holder for the table alias if
* you need to include the table alias in the clause.
*
- *
* {@code
* // ... including the ${ta} table alias placeholder...
- *
+ *
* @OneToMany
* @Where(clause = "${ta}.deleted='y'")
* List topics;
*
* }
- *
*
* This will be added to the where clause when lazy loading the OneToMany
* property or when there is a join to that OneToMany property.
*
*/
-@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Where.List.class)
public @interface Where {
diff --git a/src/main/java/com/avaje/ebean/annotation/WhoCreated.java b/src/main/java/com/avaje/ebean/annotation/WhoCreated.java
index c9dcfdfae..8bb199834 100644
--- a/src/main/java/com/avaje/ebean/annotation/WhoCreated.java
+++ b/src/main/java/com/avaje/ebean/annotation/WhoCreated.java
@@ -12,8 +12,7 @@ import java.lang.annotation.Target;
* To use this annotation you need to implement CurrentUserProvider.
* The type of the bean property should match the type returned by
* CurrentUserProvider.
- *
-
+ *
* Example:
* {@code
*
@@ -22,7 +21,7 @@ import java.lang.annotation.Target;
*
* }
*/
-@Target({ ElementType.FIELD, ElementType.METHOD })
+@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface WhoCreated {
diff --git a/src/main/java/com/avaje/ebean/annotation/WhoModified.java b/src/main/java/com/avaje/ebean/annotation/WhoModified.java
index 1ef57e298..5bd2c9de0 100644
--- a/src/main/java/com/avaje/ebean/annotation/WhoModified.java
+++ b/src/main/java/com/avaje/ebean/annotation/WhoModified.java
@@ -13,7 +13,6 @@ import java.lang.annotation.Target;
* The type of the bean property should match the type returned by
* CurrentUserProvider.
*
- *
* Example:
* {@code
*
diff --git a/src/main/java/com/avaje/ebean/annotation/package.html b/src/main/java/com/avaje/ebean/annotation/package.html
index c39eed7aa..a3cb62253 100644
--- a/src/main/java/com/avaje/ebean/annotation/package.html
+++ b/src/main/java/com/avaje/ebean/annotation/package.html
@@ -1,14 +1,14 @@
-
- Extra deployment annotations
+
+ Extra deployment annotations
Extra deployment annotations
-Extra deployment annotations for entity beans.
+ Extra deployment annotations for entity beans.
-
\ No newline at end of file
+