diff --git a/src/main/java/com/avaje/ebean/BackgroundExecutor.java b/src/main/java/com/avaje/ebean/BackgroundExecutor.java index 12edb0a51..8f2afbf64 100644 --- a/src/main/java/com/avaje/ebean/BackgroundExecutor.java +++ b/src/main/java/com/avaje/ebean/BackgroundExecutor.java @@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit; * code if you want. It can be useful for some server caching implementations * (background population and trimming of the cache etc). *

- * + * * @author rbygrave */ public interface BackgroundExecutor { diff --git a/src/main/java/com/avaje/ebean/BeanState.java b/src/main/java/com/avaje/ebean/BeanState.java index a6708a783..7972abbd4 100644 --- a/src/main/java/com/avaje/ebean/BeanState.java +++ b/src/main/java/com/avaje/ebean/BeanState.java @@ -45,13 +45,11 @@ public interface BeanState { /** * Set the loaded state of the property given it's name. - * *

- * 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 getDirtyValues(); - + Map getDirtyValues(); + /** * Return true if the bean is readOnly. *

@@ -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: *

- * - *
- * 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);
- * 
- * + * + * }
*

* Example 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(?,?)}";
- * 
+ *
+ * 
{@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();
  * }
- * 
- * + * }
+ * * @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. *

- * - * @param position - * the index position of the parameter. - * @param value - * the value of the parameter. + * + * @param position the index position of the parameter. + * @param value the value of the parameter. */ CallableSql bind(int position, Object value); /** * Bind a positioned parameter (same as bind method). - * - * @param position - * the index position of the parameter. - * @param value - * the value of the parameter. + * + * @param position the index position of the parameter. + * @param value the value of the parameter. */ CallableSql setParameter(int position, Object value); @@ -147,11 +144,9 @@ public interface CallableSql { * This is designed so that you do not need to register params in index order. * You can set/register param 2 before param 1 etc. *

- * - * @param position - * the index position of the parameter (starts with 1). - * @param type - * the jdbc type of the OUT parameter that will be read. + * + * @param position the index position of the parameter (starts with 1). + * @param type the jdbc type of the OUT parameter that will be read. */ CallableSql registerOut(int position, int type); @@ -168,7 +163,6 @@ public interface CallableSql { Object getObject(int position); /** - * * You can extend this object and override this method for more advanced * stored procedure calls. This would be the case when ResultSets are returned * etc. @@ -190,4 +184,4 @@ public interface CallableSql { */ CallableSql addModification(String tableName, boolean inserts, boolean updates, boolean deletes); -} \ No newline at end of file +} diff --git a/src/main/java/com/avaje/ebean/DRawSqlColumnsParser.java b/src/main/java/com/avaje/ebean/DRawSqlColumnsParser.java index 43a96a191..6cb9d14ce 100644 --- a/src/main/java/com/avaje/ebean/DRawSqlColumnsParser.java +++ b/src/main/java/com/avaje/ebean/DRawSqlColumnsParser.java @@ -1,10 +1,9 @@ package com.avaje.ebean; -import java.util.ArrayList; +import com.avaje.ebean.RawSql.ColumnMapping; import javax.persistence.PersistenceException; - -import com.avaje.ebean.RawSql.ColumnMapping; +import java.util.ArrayList; /** * Parses columnMapping (select clause) mapping columns to bean properties. @@ -74,7 +73,7 @@ final class DRawSqlColumnsParser { // build back the 'column formula' that precedes the AS keyword StringBuilder sb = new StringBuilder(); sb.append(split[0]); - for (int i = 1; i < split.length-2; i++) { + for (int i = 1; i < split.length - 2; i++) { sb.append(" ").append(split[i]); } return new ColumnMapping.Column(indexPos++, sb.toString(), split[split.length - 1]); diff --git a/src/main/java/com/avaje/ebean/DRawSqlParser.java b/src/main/java/com/avaje/ebean/DRawSqlParser.java index 1f3b9a560..a212c795c 100644 --- a/src/main/java/com/avaje/ebean/DRawSqlParser.java +++ b/src/main/java/com/avaje/ebean/DRawSqlParser.java @@ -47,7 +47,7 @@ class DRawSqlParser { private DRawSqlParser(String sqlString) { sqlString = sqlString.trim(); - sqlString = sqlString.replace('\n',' '); + sqlString = sqlString.replace('\n', ' '); this.sql = sqlString; this.hasPlaceHolders = findAndRemovePlaceHolders(); this.textParser = new SimpleTextParser(sqlString); diff --git a/src/main/java/com/avaje/ebean/DocumentStore.java b/src/main/java/com/avaje/ebean/DocumentStore.java index 22b30f953..95e0a1134 100644 --- a/src/main/java/com/avaje/ebean/DocumentStore.java +++ b/src/main/java/com/avaje/ebean/DocumentStore.java @@ -93,7 +93,6 @@ public interface DocumentStore { *

* 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();
    *
    * }
- * */ PagedList findPagedList(DocQueryRequest request); @@ -117,7 +115,6 @@ public interface DocumentStore { *

* 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 33020f033..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);
  *
@@ -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 f09304f87..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); @@ -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,7 +1018,6 @@ public interface EbeanServer {
    * }
* * @return the list of values for the selected property - * * @see Query#findSingleAttributeList() */ List findSingleAttributeList(Query query, Transaction transaction); 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 7c9bc747c..959846796 100644 --- a/src/main/java/com/avaje/ebean/FutureRowCount.java +++ b/src/main/java/com/avaje/ebean/FutureRowCount.java @@ -8,8 +8,8 @@ import java.util.concurrent.Future; *

* It extends the java.util.concurrent.Future. *

- * - * @param the BeanType + * + * @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 5d2121882..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)
diff --git a/src/main/java/com/avaje/ebean/Model.java b/src/main/java/com/avaje/ebean/Model.java
index d4553a528..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,7 +494,7 @@ public abstract class Model { /** * Creates a Finder for the named EbeanServer. - * + *

*

* Create and return a new Finder for a different server. */ @@ -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 b342fb23a..b62041cbf 100644 --- a/src/main/java/com/avaje/ebean/OrderBy.java +++ b/src/main/java/com/avaje/ebean/OrderBy.java @@ -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(); } } diff --git a/src/main/java/com/avaje/ebean/PagedList.java b/src/main/java/com/avaje/ebean/PagedList.java index 2b93872cc..253641784 100644 --- a/src/main/java/com/avaje/ebean/PagedList.java +++ b/src/main/java/com/avaje/ebean/PagedList.java @@ -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/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 f2727e398..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,9 +56,8 @@ 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
@@ -74,9 +78,9 @@ import com.avaje.ebean.util.CamelCaseHelper;
  *  ...
  *
  * }
- * + *

*

Example 1:

- * + *

*

{@code
  *
  *   String sql = " select order_id, o.status, c.id, c.name, sum(d.order_qty*d.unit_price) as totalAmount"
@@ -102,15 +106,14 @@ import com.avaje.ebean.util.CamelCaseHelper;
  *
  *
  * }
- * + *

*

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 "
@@ -133,11 +136,10 @@ import com.avaje.ebean.util.CamelCaseHelper;
  *     .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,12 +164,10 @@ 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 { @@ -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() { @@ -476,8 +475,7 @@ 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() { @@ -566,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); @@ -719,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 cd8ac0c50..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 + "]"; } /** 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/overview.html b/src/main/java/com/avaje/ebean/overview.html index 4ce74e843..7f85d3c41 100644 --- a/src/main/java/com/avaje/ebean/overview.html +++ b/src/main/java/com/avaje/ebean/overview.html @@ -1,6 +1,6 @@ - Ebean API + Ebean API Ebean Object Relational Mapping (start at @@ -9,48 +9,48 @@ Ebean Object Relational Mapping (start at

Ebean

-Provides the main API for fetching and persisting beans with Ebean. + Provides the main API for fetching and persisting beans with Ebean.

-For a full description of the query language refer to Query. + For a full description of the query language refer to Query.

-  +  

-

-EXAMPLE 1: Simple fetch -

-
{@code
+  

+ EXAMPLE 1: Simple fetch +

+
{@code
 // fetch order 10
 Order order = Ebean.find(Order.class, 10);
 }
-

-EXAMPLE 2: Fetch an Object with associations -

-
{@code
+  

+ EXAMPLE 2: Fetch an Object with associations +

+
{@code
 // fetch Customer 7 including their billing and shipping addresses
 Customer customer = Ebean.find(Customer.class)
     .fetch("billingAddress");
     .fetch("shippingAddress");
     .setId(7)
     .findUnique();
-	
-		
+
+
 Address billAddr = customer.getBillingAddress();
 Address shipAddr = customer.getShippingAddress();
 }
-

-EXAMPLE 3: Fetch a list of Objects with associations -

-
{@code
+  

+ EXAMPLE 3: Fetch a list of Objects with associations +

+
{@code
 // Note: This example shows a "Partial Object".
-//       For the product objects associated with the 
+//       For the product objects associated with the
 //       order details only the product id and name is
 //       fetched (the product objects are partially populated).
-		
+
 // fetch orders for customer.id = 2
 List orderList = Ebean.find(Order.class);
     .fetch("customer")
@@ -62,14 +62,14 @@ List orderList = Ebean.find(Order.class);
 
 
 // Note: Only the product id and name is fetched for the
-//       product details. This is referred to as a 
-//       "Partial Object" (one that is partially populated).  
+//       product details. This is referred to as a
+//       "Partial Object" (one that is partially populated).
 
 
 // code that traverses the object graph...
 
 Order order = orderList.get(0);
-Customer customer = order.getCustomer();	
+Customer customer = order.getCustomer();
 Address shipAddr = customer.getShippingAddress();
 
 List details = order.getDetails();
@@ -79,10 +79,10 @@ String productName = product.getName();
 
 }
-

-EXAMPLE 4: Create and save an Order -

-
{@code
+  

+ EXAMPLE 4: Create and save an Order +

+
{@code
 // get a Customer reference so we don't hit the database
 Customer custRef = Ebean.getReference(Customer.class, 7);
 
@@ -109,25 +109,25 @@ Ebean.save(newOrder);
 
 }
-

-EXAMPLE 5: Use another database -

-
{@code
+  

+ EXAMPLE 5: Use another database +

+
{@code
 // Get access to the Human Resources EbeanServer/Database
 EbeanServer hrServer = Ebean.getServer("HR");
-                                    
-                              
+
+
 // fetch contact 3 from the HR database
 Contact contact = hrServer.find(Contact.class, 3);
-                                    
+
 contact.setStatus(Contact.Status.INACTIVE);
 ...
-                                    
+
 // save the contact back to the HR database
-hrServer.save(contact); 	
+hrServer.save(contact);
 }
- \ No newline at end of file + diff --git a/src/main/java/com/avaje/ebean/package.html b/src/main/java/com/avaje/ebean/package.html index 3f1155af5..0c825cc56 100644 --- a/src/main/java/com/avaje/ebean/package.html +++ b/src/main/java/com/avaje/ebean/package.html @@ -1,13 +1,13 @@ - Ebean core API + Ebean core API Core API (see
EbeanServer and Ebean).

Ebean

-Provides the main API for fetching and persisting beans with eBean. + Provides the main API for fetching and persisting beans with eBean.

{@code
@@ -83,4 +83,4 @@ hrServer.save(contact);
 }
- \ No newline at end of file + diff --git a/src/main/java/com/avaje/ebean/stylesheet.css b/src/main/java/com/avaje/ebean/stylesheet.css index 634ca5705..21caf36d8 100644 --- a/src/main/java/com/avaje/ebean/stylesheet.css +++ b/src/main/java/com/avaje/ebean/stylesheet.css @@ -3,40 +3,89 @@ /* Define colors, fonts and other style attributes here to override the defaults */ /* Page background color */ -body { -background-color: #FFFFFF; -font-family: Arial, Helvetica, sans-serif; -font-size:10pt; +body { + background-color: #FFFFFF; + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; } pre.code { - padding:1em; - margin-left:2em; - border: 1px solid #ccc; - background-color: #eee; + padding: 1em; + margin-left: 2em; + border: 1px solid #ccc; + background-color: #eee; } /* Headings */ -h1 { font-size: 14pt } +h1 { + font-size: 14pt +} -#overviewexamples h3 {font-size:10pt } +#overviewexamples h3 { + font-size: 10pt +} /* Table colors */ -.TableHeadingColor { background: #CCCCFF } /* Dark mauve */ -.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ -.TableRowColor { background: #FFFFFF } /* White */ +.TableHeadingColor { + background: #CCCCFF +} + +/* Dark mauve */ +.TableSubHeadingColor { + background: #EEEEFF +} + +/* Light mauve */ +.TableRowColor { + background: #FFFFFF +} + +/* White */ /* Font used in left-hand frame lists */ -.FrameTitleFont { font-size: 12pt; font-family: Helvetica, Arial, sans-serif } -.FrameHeadingFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } -.FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } +.FrameTitleFont { + font-size: 12pt; + font-family: Helvetica, Arial, sans-serif +} + +.FrameHeadingFont { + font-size: 10pt; + font-family: Helvetica, Arial, sans-serif +} + +.FrameItemFont { + font-size: 10pt; + font-family: Helvetica, Arial, sans-serif +} /* Navigation bar fonts and colors */ -.NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */ -.NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */ -.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} -.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} +.NavBarCell1 { + background-color: #EEEEFF; +} -.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} -.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} +/* Light mauve */ +.NavBarCell1Rev { + background-color: #00008B; +} + +/* Dark Blue */ +.NavBarFont1 { + font-family: Arial, Helvetica, sans-serif; + color: #000000; +} + +.NavBarFont1Rev { + font-family: Arial, Helvetica, sans-serif; + color: #FFFFFF; +} + +.NavBarCell2 { + font-family: Arial, Helvetica, sans-serif; + background-color: #FFFFFF; +} + +.NavBarCell3 { + font-family: Arial, Helvetica, sans-serif; + background-color: #FFFFFF; +}