no effective change - format and javadoc

This commit is contained in:
Rob Bygrave
2016-11-17 19:54:54 +13:00
parent 002d7d9f27
commit 60dfe6308e
42 changed files with 680 additions and 773 deletions
@@ -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).
* </p>
*
*
* @author rbygrave
*/
public interface BackgroundExecutor {
+7 -10
View File
@@ -45,13 +45,11 @@ public interface BeanState {
/**
* Set the loaded state of the property given it's name.
*
* <p>
* 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.
* </p>
*
* <pre>{@code
*
* // populate a bean via say JSON
@@ -64,8 +62,7 @@ public interface BeanState {
* user.update();
*
* }</pre>
*
*
* <p>
* 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<String,ValuePair> getDirtyValues();
Map<String, ValuePair> getDirtyValues();
/**
* Return true if the bean is readOnly.
* <p>
@@ -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();
}
}
+43 -49
View File
@@ -13,65 +13,66 @@ import java.sql.SQLException;
* <p>
* Example 1:
* </p>
*
* <pre class="code">
* String sql = &quot;{call sp_order_mod(?,?)}&quot;;
*
* <pre>{@code
*
* String sql = "{call sp_order_mod(?,?)}";
*
* CallableSql cs = Ebean.createCallableSql(sql);
* cs.setParameter(1, &quot;turbo&quot;);
* cs.setParameter(1, "turbo");
* cs.registerOut(2, Types.INTEGER);
*
*
* Ebean.execute(cs);
*
*
* // read the out parameter
* Integer returnValue = (Integer) cs.getObject(2);
* </pre>
*
*
* }</pre>
* <p>
* Example 2:<br>
* 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.
* </p>
*
* <pre class="code">
* String sql = &quot;{call sp_insert_order(?,?)}&quot;;
*
*
* <pre>{@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(&quot;oe_order&quot;, true, false, false);
* cs.addModification(&quot;oe_order_detail&quot;, 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, &quot;Was&quot;);
* cs.setParameter(2, &quot;Banana&quot;);
* cs.setParameter(1, "Was");
* cs.setParameter(2, "Banana");
* Ebean.execute(cs);
*
* cs.setParameter(1, &quot;Here&quot;);
* cs.setParameter(2, &quot;Kumera&quot;);
*
* cs.setParameter(1, "Here");
* cs.setParameter(2, "Kumera");
* Ebean.execute(cs);
*
* cs.setParameter(1, &quot;More&quot;);
* cs.setParameter(2, &quot;Apple&quot;);
*
* cs.setParameter(1, "More");
* cs.setParameter(2, "Apple");
* Ebean.execute(cs);
*
* // Ebean.externalModification(&quot;oe_order&quot;,true,false,false);
* // Ebean.externalModification(&quot;oe_order_detail&quot;,true,true,false);
*
* // Ebean.externalModification("oe_order",true,false,false);
* // Ebean.externalModification("oe_order_detail",true,true,false);
* Ebean.commitTransaction();
*
*
* } finally {
* Ebean.endTransaction();
* }
* </pre>
*
* }</pre>
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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);
}
}
@@ -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]);
@@ -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);
@@ -93,7 +93,6 @@ public interface DocumentStore {
* <p>
* Typically this is called indirectly by findPagedList() on the query that has setUseDocStore(true).
* </p>
*
* <pre>{@code
*
* PagedList<Customer> newCustomers =
@@ -104,7 +103,6 @@ public interface DocumentStore {
* .findPagedList();
*
* }</pre>
*
*/
<T> PagedList<T> findPagedList(DocQueryRequest<T> request);
@@ -117,7 +115,6 @@ public interface DocumentStore {
* <p>
* Typically this is called indirectly by findEach() on the query that has setUseDocStore(true).
* </p>
*
* <pre>{@code
*
* server.find(Order.class)
@@ -146,8 +143,6 @@ public interface DocumentStore {
* <p>
* Typically this is called indirectly by findEachWhile() on the query that has setUseDocStore(true).
* </p>
*
*
* <pre>{@code
*
* server.find(Order.class)
@@ -175,7 +170,6 @@ public interface DocumentStore {
/**
* Drop the index from the document store (similar to DDL drop table).
*
* <pre>{@code
*
* DocumentStore documentStore = server.docStore();
@@ -183,13 +177,11 @@ public interface DocumentStore {
* documentStore.dropIndex("product_copy");
*
* }</pre>
*
*/
void dropIndex(String indexName);
/**
* Create an index given a mapping file as a resource in the classPath (similar to DDL create table).
*
* <pre>{@code
*
* DocumentStore documentStore = server.docStore();
@@ -201,8 +193,8 @@ public interface DocumentStore {
*
* }</pre>
*
* @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);
*
* }</pre>
*
* <pre>{@code
*
* // refresh_interval 1s ... restore after bulk loading
@@ -244,7 +235,6 @@ public interface DocumentStore {
* <p>
* This copy process does not use the database but instead will copy from the source index to a destination index.
* </p>
*
* <pre>{@code
*
* long copyCount = documentStore.copyIndex(Product.class, "product_copy");
@@ -263,7 +253,6 @@ public interface DocumentStore {
* <p>
* To support this the document needs to have a <code>@WhenModified</code> property.
* </p>
*
* <pre>{@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.
*
* <pre>{@code
*
* // predicates to select the source documents to copy
+80 -133
View File
@@ -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.</li>
* </ul>
*
* <p>
* For developer convenience Ebean has static methods that proxy through to the
* methods on the <em>'default'</em> 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.
* </p>
*
* <pre>{@code
*
* // fetch shipped orders (and also their customer)
@@ -76,40 +74,36 @@ import java.util.concurrent.ConcurrentHashMap;
* }
*
* }</pre>
*
* <pre>{@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);
*
* }</pre>
*
* <p>
* 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.
* </p>
*
* <pre>{@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.
* </p>
*
* <pre>{@code
* // use the "hr" database
* EbeanServer hrDatabase = Ebean.getServer("hr");
*
*
* Person person = hrDatabase.find(Person.class, 10);
* }</pre>
*
* @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.
* <p>
@@ -336,7 +328,6 @@ public final class Ebean {
* Example of using a transaction to span multiple calls to find(), save()
* etc.
* </p>
*
* <pre>{@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 {
* }
*
* }</pre>
*
* <p>
* 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.
*
* <p>
* Note that this provides an try finally alternative to using {@link #execute(TxScope, TxCallable)} or
* {@link #execute(TxScope, TxRunnable)}.
* </p>
*
* <h3>REQUIRES_NEW example:</h3>
* <pre>{@code
* // Start a new transaction. If there is a current transaction
@@ -408,7 +394,6 @@ public final class Ebean {
* }
*
* }</pre>
*
* <h3>REQUIRED example:</h3>
* <pre>{@code
*
@@ -431,7 +416,7 @@ public final class Ebean {
*
* }</pre>
*/
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 {
* <p>
* Code example:
* </p>
*
* <pre>{@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.
* </p>
*
* <pre>{@code
* public class Order { ...
*
*
* @OneToMany(cascade=CascadeType.ALL, mappedBy="order")
* List<OrderDetail> details;
* ...
* }
* }</pre>
*
* <p>
* 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 {
* <p>
* An unmodified bean that is saved or updated is normally skipped and this marks the bean as
* dirty so that it is not skipped.
*
* <pre>{@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);
*
*
* }</pre>
*/
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.
* </p>
*
* <pre>{@code
*
*
* // A 'stateless update' example
* Customer customer = new Customer();
* customer.setId(7);
* customer.setName("ModifiedNameNoOCC");
* ebeanServer.update(customer);
*
*
* }</pre>
*
*
* @see ServerConfig#setUpdatesDeleteMissingChildren(boolean)
* @see ServerConfig#setUpdateChangesOnly(boolean)
*/
@@ -731,7 +710,6 @@ public final class Ebean {
/**
* Refresh a 'many' property of a bean.
*
* <pre>{@code
*
* Order order = ...;
@@ -740,11 +718,9 @@ public final class Ebean {
* Ebean.refreshMany(order, "details");
*
* }</pre>
*
* @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 {
* <p>
* This is sometimes described as a proxy (with lazy loading).
* </p>
*
* <pre>{@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();
*
* }</pre>
*
* @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> T getReference(Class<T> 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.
* </p>
*
* <pre>{@code
*
*
* // find orders and their customers
* List<Order> 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");
*
*
* }</pre>
*
* @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 <T> void sort(List<T> 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.
*
* <pre>{@code
*
* // Fetch order 1
* Order order = Ebean.find(Order.class, 1);
*
* }</pre>
*
* <p>
* If you want more control over the query then you can use createQuery() and
* Query.findUnique();
* </p>
*
* <pre>{@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<Order> 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();
*
* }</pre>
*
* @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> T find(Class<T> 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 {
* <p>
* An example:
* </p>
*
* <pre>{@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<Topic> 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.
* </p>
*
* @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 <T> Query<T> createQuery(Class<T> 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).
*
* <p>
* <h3>Example</h3>
*
* <pre>{@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 {
* }</pre>
*
* @param beanType The type of bean to fetch
* @param eql The Ebean query
* @param <T> The type of the entity bean
*
* @param eql The Ebean query
* @param <T> The type of the entity bean
* @return The query with expressions defined as per the parsed query statement
*/
public static <T> Query<T> createQuery(Class<T> 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).
* </p>
*
* @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 <T> Query<T> find(Class<T> beanType) {
@@ -1103,28 +1065,24 @@ public final class Ebean {
* <p>
* Example:
* </p>
*
* <pre>{@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";
*
* }</pre>
*
* @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 {
* <p>
* Example:
* </p>
*
* <pre>{@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);
*
* }</pre>
*
*
* @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.
* </p>
*
* <pre>{@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).
* </p>
*
* <pre>{@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.
* </p>
*
* <pre>{@code
*
* // set specific transactional scope settings
@@ -1236,7 +1190,6 @@ public final class Ebean {
* });
*
* }</pre>
*
*/
public static <T> T execute(TxScope scope, TxCallable<T> 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).
* </p>
*
* <pre>{@code
*
* Ebean.execute(new TxCallable<String>() {
* 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).
* </p>
*
* @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();
@@ -169,7 +169,7 @@ public interface EbeanServer {
* <p>
* Useful if you use BeanPostConstructListeners or &#64;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.
* </p>
*/
<T> T createEntityBean(Class<T> 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).
*
* <p>
* <h3>Example</h3>
*
* <pre>{@code
*
* // Find order additionally fetching the customer, details and details.product name.
@@ -250,9 +249,8 @@ public interface EbeanServer {
* }</pre>
*
* @param beanType The type of bean to fetch
* @param eql The Ebean query
* @param <T> The type of the entity bean
*
* @param eql The Ebean query
* @param <T> The type of the entity bean
* @return The query with expressions defined as per the parsed query statement
*/
<T> Query<T> createQuery(Class<T> beanType, String eql);
@@ -994,7 +992,7 @@ public interface EbeanServer {
/**
* Execute the query returning a list of values for a single property.
*
* <p>
* <h3>Example 1:</h3>
* <pre>{@code
*
@@ -1005,7 +1003,6 @@ public interface EbeanServer {
* .findSingleAttributeList();
*
* }</pre>
*
* <h3>Example 2:</h3>
* <pre>{@code
*
@@ -1021,7 +1018,6 @@ public interface EbeanServer {
* }</pre>
*
* @return the list of values for the selected property
*
* @see Query#findSingleAttributeList()
*/
<A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction);
@@ -36,7 +36,7 @@ public class EbeanServerFactory {
/**
* Initialise the container with clustering configuration.
*
* <p>
* Call this prior to creating any EbeanServer instances or alternatively set the
* ContainerConfig on the ServerConfig when creating the first EbeanServer instance.
*/
@@ -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.
* </p>
*
* <pre class="code">
*
* <pre>{@code
* // create an example bean and set the properties
* // with the query parameters you want
* Customer example = new Customer();
* example.setName(&quot;Rob%&quot;);
* example.setNotes(&quot;%something%&quot;);
*
* example.setName("Rob%");
* example.setNotes("%something%");
*
* List&lt;Customer&gt; 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(&quot;id&quot;, 2)
* .gt("id", 2)
* .findList();
*
* </pre>
*
*
* }</pre>
*
* Similarly you can create an ExampleExpression
*
* <pre>
*
* <pre>{@code
*
* Customer example = new Customer();
* example.setName(&quot;Rob%&quot;);
* example.setNotes(&quot;%something%&quot;);
*
* example.setName("Rob%");
* example.setNotes("%something%");
*
* // create a ExampleExpression with more control
* ExampleExpression qbe = new ExampleExpression(example, true, LikeType.EQUAL_TO)
* .includeZeros();
*
* List&lt;Customer&gt; list =
*
* List<Customer> list =
* Ebean.find(Customer.class)
* .where()
* .add(qbe)
* .findList();
* </pre>
*
* @author Rob Bygrave
*
* }</pre>
*/
public interface ExampleExpression extends Expression {
@@ -90,4 +90,4 @@ public interface ExampleExpression extends Expression {
*/
ExampleExpression useEqualTo();
}
}
+16 -19
View File
@@ -23,20 +23,19 @@ import java.util.Map;
* Creates standard common expressions for using in a Query Where or Having
* clause.
* </p>
*
* <pre class="code">
* // Example: Using an Expr.or() method
* Query&lt;Order&gt; query = Ebean.createQuery(Order.class);
* query.where(
* Expr.or(Expr.eq(&quot;status&quot;, Order.NEW),
* Expr.gt(&quot;orderDate&quot;, lastWeek));
*
* List&lt;Order&gt; list = query.findList();
* <pre>{@code
*
* // 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();
* ...
* </pre>
*
* }</pre>
*
* @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.
* </p>
*
* @param propertyMap
* a map keyed by property names.
*
* @param propertyMap a map keyed by property names.
*/
public static Expression allEq(Map<String, Object> propertyMap) {
return Ebean.getExpressionFactory().allEq(propertyMap);
@@ -24,20 +24,19 @@ import java.util.Map;
* <p>
* The ExpressionList is returned from {@link Query#where()}.
* </p>
*
* <pre class="code">
* // Example: fetch orders where status equals new or orderDate > lastWeek.
*
* Expression newOrLastWeek =
* Expr.or(Expr.eq(&quot;status&quot;, Order.Status.NEW),
* Expr.gt(&quot;orderDate&quot;, lastWeek));
*
* Query&lt;Order&gt; query = Ebean.createQuery(Order.class);
* <pre>{@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<Order> query = Ebean.createQuery(Order.class);
* query.where().add(newOrLastWeek);
* List&lt;Order&gt; list = query.findList();
* List<Order> list = query.findList();
* ...
* </pre>
*
* }</pre>
*
* @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.
* </p>
*
* @param propertyMap
* a map keyed by property names.
*
* @param propertyMap a map keyed by property names.
*/
Expression allEq(Map<String, Object> propertyMap);
@@ -104,7 +104,7 @@ public interface ExpressionList<T> {
* Perform an 'As of' query using history tables to return the object graph
* as of a time in the past.
* <p>
* To perform this query the DB must have underlying history tables.
* To perform this query the DB must have underlying history tables.
* </p>
*
* @param asOf the date time in the past at which you want to view the data
@@ -201,7 +201,7 @@ public interface ExpressionList<T> {
/**
* Execute the query returning a list of values for a single property.
*
* <p>
* <h3>Example 1:</h3>
* <pre>{@code
*
@@ -212,7 +212,7 @@ public interface ExpressionList<T> {
* .findSingleAttributeList();
*
* }</pre>
*
* <p>
* <h3>Example 2:</h3>
* <pre>{@code
*
@@ -240,7 +240,6 @@ public interface ExpressionList<T> {
* </p>
*
* @throws NonUniqueResultException if more than one result was found
*
* @see Query#findUnique()
*/
@Nullable
@@ -292,7 +291,7 @@ public interface ExpressionList<T> {
* If maxRows is not set on the query prior to calling findPagedList() then a
* PersistenceException is thrown.
* </p>
*
* <p>
* <pre>{@code
*
* PagedList<Order> pagedList = Ebean.find(Order.class)
@@ -309,7 +308,6 @@ public interface ExpressionList<T> {
* }</pre>
*
* @return The PagedList
*
* @see Query#findPagedList()
*/
PagedList<T> findPagedList();
@@ -317,8 +315,8 @@ public interface ExpressionList<T> {
/**
* Return versions of a @History entity bean.
* <p>
* 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.
* </p>
*/
List<Version<T>> findVersions();
@@ -326,8 +324,8 @@ public interface ExpressionList<T> {
/**
* Return versions of a @History entity bean between the 2 timestamps.
* <p>
* 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.
* </p>
*/
List<Version<T>> findVersionsBetween(Timestamp start, Timestamp end);
@@ -440,7 +438,6 @@ public interface ExpressionList<T> {
/**
* Path exists - for the given path in a JSON document.
*
* <pre>{@code
*
* where().jsonExists("content", "path.other")
@@ -448,13 +445,12 @@ public interface ExpressionList<T> {
* }</pre>
*
* @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<T> jsonExists(String propertyName, String path);
/**
* Path does not exist - for the given path in a JSON document.
*
* <pre>{@code
*
* where().jsonNotExists("content", "path.other")
@@ -462,13 +458,13 @@ public interface ExpressionList<T> {
* }</pre>
*
* @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<T> jsonNotExists(String propertyName, String path);
/**
* Equal to expression for the value at the given path in the JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonEqualTo("content", "path.other", 34)
@@ -476,14 +472,14 @@ public interface ExpressionList<T> {
* }</pre>
*
* @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<T> jsonEqualTo(String propertyName, String path, Object value);
/**
* Not Equal to - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonNotEqualTo("content", "path.other", 34)
@@ -491,14 +487,14 @@ public interface ExpressionList<T> {
* }</pre>
*
* @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<T> jsonNotEqualTo(String propertyName, String path, Object value);
/**
* Greater than - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonGreaterThan("content", "path.other", 34)
@@ -509,7 +505,7 @@ public interface ExpressionList<T> {
/**
* Greater than or equal to - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonGreaterOrEqual("content", "path.other", 34)
@@ -520,7 +516,7 @@ public interface ExpressionList<T> {
/**
* Less than - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonLessThan("content", "path.other", 34)
@@ -531,7 +527,7 @@ public interface ExpressionList<T> {
/**
* Less than or equal to - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonLessOrEqualTo("content", "path.other", 34)
@@ -542,7 +538,7 @@ public interface ExpressionList<T> {
/**
* Between - for the given path in a JSON document.
*
* <p>
* <pre>{@code
*
* where().jsonBetween("content", "orderDate", lowerDateTime, upperDateTime)
@@ -556,7 +552,7 @@ public interface ExpressionList<T> {
* <p>
* This returns the list so that add() can be chained.
* </p>
*
* <p>
* <pre>{@code
*
* Query<Customer> query = Ebean.find(Customer.class);
@@ -647,7 +643,7 @@ public interface ExpressionList<T> {
* To get control over the options you can create an ExampleExpression and set
* those options such as case insensitive etc.
* </p>
*
* <p>
* <pre>{@code
*
* // create an example bean and set the properties
@@ -663,9 +659,9 @@ public interface ExpressionList<T> {
* .gt("id", 2).findList();
*
* }</pre>
*
* <p>
* Similarly you can create an ExampleExpression
*
* <p>
* <pre>{@code
*
* Customer example = new Customer();
@@ -804,8 +800,7 @@ public interface ExpressionList<T> {
* corresponding value.
* </p>
*
* @param propertyMap
* a map keyed by property names.
* @param propertyMap a map keyed by property names.
*/
ExpressionList<T> allEq(Map<String, Object> propertyMap);
@@ -849,7 +844,7 @@ public interface ExpressionList<T> {
* then they are not translated. logical property name names (not fully
* qualified) will still be translated to their physical name.
* </p>
*
* <p>
* <h4>Example:</h4>
* <pre>{@code
*
@@ -881,7 +876,7 @@ public interface ExpressionList<T> {
* then they are not translated. logical property name names (not fully
* qualified) will still be translated to their physical name.
* </p>
*
* <p>
* <pre>{@code
*
* raw("orderQty < shipQty")
@@ -894,7 +889,7 @@ public interface ExpressionList<T> {
* Add a match expression.
*
* @param propertyName The property name for the match
* @param search The search value
* @param search The search value
*/
ExpressionList<T> match(String propertyName, String search);
@@ -902,14 +897,14 @@ public interface ExpressionList<T> {
* 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<T> match(String propertyName, String search, Match options);
/**
* Add a multi-match expression.
*/
ExpressionList<T> multiMatch(String search, String... properties);
ExpressionList<T> multiMatch(String search, String... properties);
/**
* Add a multi-match expression using options.
@@ -960,7 +955,7 @@ public interface ExpressionList<T> {
* typically you only explicitly need to use the and() junction
* when it is nested inside an or() or not() junction.
* </p>
*
* <p>
* <pre>{@code
*
* // Example: Nested and()
@@ -985,11 +980,11 @@ public interface ExpressionList<T> {
/**
* Return a list of expressions that will be joined by OR's.
* This is exactly the same as disjunction();
*
* <p>
* Use endOr() or endJunction() to end the OR junction.
* <p>
* Use endOr() or endJunction() to end the OR junction.
* </p>
*
* <p>
* <pre>{@code
*
* // Example: Use or() to join
@@ -1016,10 +1011,10 @@ public interface ExpressionList<T> {
/**
* Return a list of expressions that will be wrapped by NOT.
* <p>
* 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.
* </p>
*
* <p>
* <pre>@{code
*
* .where()
@@ -1029,7 +1024,7 @@ public interface ExpressionList<T> {
* .endNot()
*
* }</pre>
*
* <p>
* <pre>@{code
*
* // Example: nested not()
+33 -29
View File
@@ -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.
* </p>
*
* <p>
* <pre>{@code
* // Normal fetch join results in a single SQL query
* List<Order> list = Ebean.find(Order.class).fetch("details").findList();
*
*
* // Find Orders join details using a single SQL query
* }</pre>
* <p>
* Example: Using a "query join" instead of a "fetch join" we instead use 2 SQL queries
* </p>
*
* <p>
* <pre>{@code
*
* // This will use 2 SQL queries to build this object graph
* List<Order> 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
*
* }</pre>
* <p>
* Example: Using 2 "query joins"
* </p>
*
* <p>
* <pre>{@code
*
* // This will use 3 SQL queries to build this object graph
* List<Order> 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
*
* }</pre>
* <p>
* Example: Using "query joins" and partial objects
* </p>
*
* <p>
*
* <pre>{@code
* // This will use 3 SQL queries to build this object graph
* List<Order> 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).
* </p>
*
* <p>
* <pre>{@code
*
* List<Order> 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
*
*
* }</pre>
*
* <p>
* <p>
* Example of controlling the lazy loading query:
* </p>
@@ -112,22 +118,23 @@ import java.io.Serializable;
* This gives us the ability to optimise the lazy loading query for a given use
* case.
* </p>
*
* <p>
* <pre>{@code
*
* List<Order> 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
*
*
* }</pre>
*
*
* @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.
* </p>
*
* @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.
* </p>
*
* @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.
*/
+38 -39
View File
@@ -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.
* </p>
*
* <pre class="code">
*
* <p>
* <pre>{@code
*
* // get a list of entities (query execution statistics in this case)
*
* List&lt;MetaQueryStatistic&gt; list =
*
* List<MetaQueryStatistic> list =
* Ebean.find(MetaQueryStatistic.class).findList();
*
*
* long nowMinus24Hrs = System.currentTimeMillis() - 24 * (1000 * 60 * 60);
*
*
* // sort and filter the list returning a filtered list...
*
* List&lt;MetaQueryStatistic&gt; filteredList =
*
* List<MetaQueryStatistic> filteredList =
* Ebean.filter(MetaQueryStatistic.class)
* .sort(&quot;avgTimeMicros desc&quot;)
* .gt(&quot;executionCount&quot;, 0)
* .gt(&quot;lastQueryTime&quot;, nowMinus24Hrs)
* .eq(&quot;autoTuned&quot;, true)
* .sort("avgTimeMicros desc")
* .gt("executionCount", 0)
* .gt("lastQueryTime", nowMinus24Hrs)
* .eq("autoTuned", true)
* .maxRows(10)
* .filter(list);
*
* </pre>
*
* }</pre>
* <p>
* 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.
* </p>
*
* <pre>
* // examples of property names that
* <p>
* <pre>{@code
*
* // examples of property names that
* // ... will traverse the object graph
* // ... where customer is a property of our bean
*
*
* customer.name
* customer.shippingAddress.city
* </pre>
*
* </p>
*
* <pre class="code">
*
*
* }</pre>
* <p>
* <pre>{@code
*
* // get a list of entities (query execution statistics)
*
* List&lt;Order&gt; orders =
*
* List<Order> orders =
* Ebean.find(Order.class).findList();
*
*
* // Apply a filter...
*
* List&lt;Order&gt; filteredOrders =
*
* List<Order> filteredOrders =
* Ebean.filter(Order.class)
* .startsWith(&quot;customer.name&quot;, &quot;Rob&quot;)
* .eq(&quot;customer.shippingAddress.city&quot;, &quot;Auckland&quot;)
* .startsWith("customer.name", "Rob")
* .eq("customer.shippingAddress.city", "Auckland")
* .filter(orders);
*
* </pre>
*
* @param <T>
* the entity bean type
*
* }</pre>
*
* @param <T> the entity bean type
*/
public interface Filter<T> {
@@ -189,9 +188,9 @@ public interface Filter<T> {
* <p>
* The sourceList will remain unmodified.
* </p>
*
*
* @return Returns a new list with the sorting and filters applied.
*/
List<T> filter(List<T> sourceList);
}
}
+4 -11
View File
@@ -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).
* </p>
*
* <h3>Testing</h3>
* <p>
* 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
* <p>
* </p>
* <pre>{@code
*
@@ -61,7 +60,6 @@ public class Finder<I, T> {
/**
* Create with the type of the entity bean.
*
* <pre>{@code
*
* public class CustomerFinder extends Finder<Customer> {
@@ -96,10 +94,8 @@ public class Finder<I, T> {
/**
* Return the underlying 'default' EbeanServer.
*
* <p>
* 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<I, T> {
* <p>
* 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<I, T> {
/**
* Creates an entity reference for this ID.
*
* <p>
* Equivalent to {@link EbeanServer#getReference(Class, Object)}
*/
@@ -130,7 +124,6 @@ public class Finder<I, T> {
/**
* Retrieves an entity by ID.
*
* <p>
* Equivalent to {@link EbeanServer#find(Class, Object)}
*/
+8 -11
View File
@@ -17,31 +17,30 @@ import java.util.concurrent.TimeoutException;
* <p>
* A simple example:
* </p>
*
* <pre>{@code
*
* // create a query to find all orders
* Query<Order> query = Ebean.find(Order.class);
*
*
* // execute the query in a background thread
* // immediately returning the futureList
* FutureList<Order> 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<Order> list = futureList.get();
* ...
* }
*
*
* }</pre>
*/
public interface FutureList<T> extends Future<List<T>> {
@@ -56,7 +55,6 @@ public interface FutureList<T> extends Future<List<T>> {
* unchecked PersistenceException.
*
* @return The query list result
*
* @throws PersistenceException when a InterruptedException or ExecutionException occurs.
*/
List<T> getUnchecked();
@@ -66,8 +64,7 @@ public interface FutureList<T> extends Future<List<T>> {
* 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<T> getUnchecked(long timeout, TimeUnit unit) throws TimeoutException;
@@ -8,8 +8,8 @@ import java.util.concurrent.Future;
* <p>
* It extends the java.util.concurrent.Future.
* </p>
*
* @param <T> the BeanType
*
* @param <T> the BeanType
* @author rbygrave
*/
public interface FutureRowCount<T> extends Future<Integer> {
+2 -5
View File
@@ -9,7 +9,6 @@ package com.avaje.ebean;
* <p>
* Note: where() always takes you to the top level WHERE expression list.
* </p>
*
* <pre>{@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 &gt; 10) )
* }</pre>
*
* }</pre>
* <p>
* Note: endJunction() takes you to the parent expression list
* </p>
*
* <pre>{@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) )
* }</pre>
*
* <p>
* Example of a nested disjunction.
* </p>
*
* <pre>{@code
* Query<Customer> q =
* Ebean.find(Customer.class)
+49 -61
View File
@@ -13,31 +13,26 @@ import java.util.UUID;
/**
* A MappedSuperclass base class that provides convenience methods for inserting, updating and
* deleting beans.
*
* <p>
* By having your entity beans extend this it provides a 'Active Record' style programming model for
* Ebean users.
*
* <p>
* 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.
*
* <p>
* 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.
*
* <p>
* 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.
*
* <p>
* 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.
*
* <p>
* <h3>Typical common @MappedSuperclass</h3>
* <pre>{@code
*
@@ -58,7 +53,7 @@ import java.util.UUID;
* ...
*
* }</pre>
*
* <p>
* <h3>Extend the Model</h3>
* <pre>{@code
*
@@ -78,7 +73,7 @@ import java.util.UUID;
* }
*
* }</pre>
*
* <p>
* <h3>Modal: save()</h3>
* <pre>{@code
*
@@ -90,7 +85,7 @@ import java.util.UUID;
* customer.save();
*
* }</pre>
*
* <p>
* <h3>Find byId</h3>
* <pre>{@code
*
@@ -98,7 +93,7 @@ import java.util.UUID;
* Customer customer = Customer.find.byId(42);
*
* }</pre>
*
* <p>
* <h3>Find where</h3>
* <pre>{@code
*
@@ -115,39 +110,37 @@ public abstract class Model {
/**
* Return the underlying 'default' EbeanServer.
*
* <p>
* This provides full access to the API such as explicit transaction demarcation etc.
*
* <p>
* Example:
* <pre>{@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(&quot;Roberto&quot;);
* customer.save();
*
*
* Customer otherCustomer = new Customer();
* otherCustomer.setName("Franko");
* otherCustomer.save();
*
*
* transaction.commit();
*
*
* } finally {
* transaction.end();
* }
*
*
* }</pre>
*/
public static EbeanServer db() {
@@ -156,13 +149,11 @@ public abstract class Model {
/**
* Return a named EbeanServer that is typically different to the default server.
*
* <p>
* 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 {
* <p>
* An unmodified bean that is saved or updated is normally skipped and this marks the bean as
* dirty so that it is not skipped.
*
* <p>
* <pre>{@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();
*
*
* }</pre>
*
* @see EbeanServer#markAsDirty(Object)
@@ -197,7 +188,7 @@ public abstract class Model {
/**
* Mark the property as unset or 'not loaded'.
* <p>
* 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.
* </p>
* <pre>{@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.
*
* <p>
* 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.
* </p>
*
* @param <I> type of the Id property
* @param <T> type of the entity bean
*/
@@ -326,7 +317,7 @@ public abstract class Model {
/**
* Create with the type of the entity bean.
*
* <p>
* <pre>{@code
*
* @Entity
@@ -336,11 +327,11 @@ public abstract class Model {
* ...
*
* }</pre>
*
* <p>
* <p/>
* The preferred approach is to instead use <code>Find</code> as below. This approach is more DRY in that it does
* not require the class literal Customer.class to be passed into the constructor.
*
* <p>
* <pre>{@code
*
* @Entity
@@ -366,13 +357,13 @@ public abstract class Model {
/**
* Helper object for performing queries.
*
* <p>
* <p>
* Typically a Find instance is defined as a public static field on an entity bean class to provide a
* nice way to write queries.
*
* <p>
* <h3>Example use:</h3>
*
* <p>
* <pre>{@code
*
* @Entity
@@ -395,7 +386,7 @@ public abstract class Model {
* .findList();
*
* }</pre>
*
* <p>
* <h3>Kotlin</h3>
* In Kotlin you would typically create Find as a companion object.
* <pre>{@code
@@ -404,12 +395,10 @@ public abstract class Model {
* companion object : Model.Find<Long, Product>() {}
*
* }</pre>
* @param <I>
* The Id type. This is most often a {@link Long} but is also often a {@link UUID} or
* {@link String}.
*
* @param <T>
* The entity bean type
* @param <I> The Id type. This is most often a {@link Long} but is also often a {@link UUID} or
* {@link String}.
* @param <T> The entity bean type
*/
public static abstract class Find<I, T> {
@@ -427,11 +416,11 @@ public abstract class Model {
* Creates a finder for entity of type <code>T</code> with ID of type <code>I</code>.
* <p/>
* Typically you create Find as a public static field on each entity bean as the example below.
*
* <p>
* <p/>
* Note that Find is an abstract class and hence <code>{}</code> is required. This is done so
* that the type (class literal) of the entity bean can be derived from the generics parameter.
*
* <p>
* <pre>{@code
*
* @Entity
@@ -456,10 +445,10 @@ public abstract class Model {
* .findList();
*
* }</pre>
*
* <p>
* <h3>Kotlin</h3>
* In Kotlin you would typically create it as a companion object.
*
* <p>
* <pre>{@code
*
* // kotlin
@@ -470,7 +459,7 @@ public abstract class Model {
@SuppressWarnings("unchecked")
public Find() {
this.serverName = null;
this.type = (Class<T>)ClassUtil.getSecondArgumentType(getClass());
this.type = (Class<T>) ClassUtil.getSecondArgumentType(getClass());
}
/**
@@ -483,10 +472,9 @@ public abstract class Model {
/**
* Return the underlying 'default' EbeanServer.
*
* <p>
* <p>
* 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.
* <p>
* 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.
*
* <p>
* <p>
* 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.
*
* <p>
* <p>
* This is the same as (synonym for) {@link #findList()}
*/
@@ -536,7 +523,7 @@ public abstract class Model {
/**
* Retrieves an entity by ID.
*
* <p>
* <p>
* Equivalent to {@link EbeanServer#find(Class, Object)}
*/
@@ -547,7 +534,7 @@ public abstract class Model {
/**
* Creates an entity reference for this ID.
*
* <p>
* <p>
* 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.
*
* <p>
* <p>
* 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.
*
* <p>
* <p>
* This will typically create row level database locks on the selected rows.
*/
@@ -895,4 +883,4 @@ public abstract class Model {
}
}
}
}
+1 -1
View File
@@ -294,7 +294,7 @@ public final class OrderBy<T> implements Serializable {
sb.append(" ").append("desc");
}
sb.append(" ").append(nulls).append(" ").append(highLow);
return sb.toString();
return sb.toString();
}
}
+5 -13
View File
@@ -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.
* </p>
*
*
* <p>
* <h4>Example: typical use including total row count</h4>
* <pre>{@code
*
@@ -43,8 +42,7 @@ import java.util.concurrent.Future;
* int totalRowCount = pagedList.getTotalRowCount();
*
* }</pre>
*
*
* <p>
* <h4>Example: No total row count required</h4>
* <pre>{@code
*
@@ -57,9 +55,7 @@ import java.util.concurrent.Future;
*
* }</pre>
*
* @param <T>
* the entity bean type
*
* @param <T> the entity bean type
* @see Query#findPagedList()
*/
public interface PagedList<T> {
@@ -79,7 +75,6 @@ public interface PagedList<T> {
* int totalRowCount = pagedList.getTotalRowCount();
*
* }</pre>
*
* <p>
* 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<T> {
* the total row count query if it has not already been invoked.
* </p>
*
* @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);
+2 -2
View File
@@ -724,7 +724,7 @@ public interface Query<T> {
/**
* Execute the query returning a list of values for a single property.
*
* <p>
* <h3>Example 1:</h3>
* <pre>{@code
*
@@ -735,7 +735,7 @@ public interface Query<T> {
* .findSingleAttributeList();
*
* }</pre>
*
* <p>
* <h3>Example 2:</h3>
* <pre>{@code
*
@@ -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.
* </p>
*
* <p>
* <pre>{@code
*
* Query<Customer> query = server.find(Customer.class)
@@ -25,17 +25,15 @@ package com.avaje.ebean;
* });
*
* }</pre>
*
* @param <T>
* the type of entity bean being queried.
*
* @param <T> the type of entity bean being queried.
*/
public interface QueryEachConsumer<T> {
/**
* Process the bean.
*
* @param bean
* the entity bean to process
*
* @param bean the entity bean to process
*/
void accept(T bean);
}
@@ -12,23 +12,24 @@ package com.avaje.ebean;
* QueryResultVisitor useful for processing large queries.
* </p>
* <p/>
* <pre class="code">
* <pre>{@code
*
* Query&lt;Customer&gt; query = server.find(Customer.class)
* .fetch(&quot;contacts&quot;, new FetchConfig().query(2))
* .where().gt(&quot;id&quot;, 0)
* .orderBy(&quot;id&quot;)
* Query<Customer> 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(&quot;-- visit &quot; + customer);
* System.out.println("-- visit " + customer);
*
* // return true to continue processing or false to stop
* return (customer.getId() < 40);
* });
* </pre>
*
* }</pre>
*
* @param <T> the type of entity bean being queried.
*/
@@ -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).
* </p>
*
* <pre>{@code
*
*
* Query<Customer> query = server.find(Customer.class)
* .where().gt("id", 0)
* .orderBy("id")
@@ -39,9 +38,8 @@ import java.util.Iterator;
* }
*
* }</pre>
*
* @param <T>
* the type of entity bean in the iteration
*
* @param <T> the type of entity bean in the iteration
*/
public interface QueryIterator<T> extends Iterator<T>, java.io.Closeable {
+22 -24
View File
@@ -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 &#064;OneToOne
* to Order.
* </p>
*
* <p>
* <h3>Example OrderAggregate</h3>
*
* <pre>{@code
* ...
* // @Sql indicates to that this bean
@@ -74,9 +78,9 @@ import com.avaje.ebean.util.CamelCaseHelper;
* ...
*
* }</pre>
*
* <p>
* <h3>Example 1:</h3>
*
* <p>
* <pre>{@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;
*
*
* }</pre>
*
* <p>
* <h3>Example 2:</h3>
*
* <p>
* 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.
* </p>
*
* <p>
* <pre>{@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();
*
* }</pre>
*
*
* <p>
* <h3>Example 3: tableAliasMapping</h3>
* <p>
* 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().
* </p>
* <pre>{@code
*
@@ -162,12 +164,10 @@ import com.avaje.ebean.util.CamelCaseHelper;
* .findList();
*
* }</pre>
*
*
* <p>
* <p>
* Note that lazy loading also works with object graphs built with RawSql.
* </p>
*
*/
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<String, Column> 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
@@ -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.
* <p>
* Note that RawSql can also be defined in ebean-orm.xml files and be used as a
* named query.
* </p>
*
*
* @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.
* </p>
*
* @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;
}
}
+6 -8
View File
@@ -18,23 +18,22 @@ import java.util.List;
* The returned SqlRow objects are similar to a LinkedHashMap with some type
* conversion support added.
* </p>
*
* <p>
* <pre>{@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<SqlRow> list = sqlQuery.findList();
*
* }</pre>
*
*/
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.
* </p>
*
* @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);
+14 -12
View File
@@ -16,19 +16,21 @@ package com.avaje.ebean;
* notify Ebean of external changes and enable Ebean to maintain it's "L2"
* server cache.
* </p>
*
* <pre class="code">
* // example that uses 'named' parameters
* String s = &quot;UPDATE f_topic set post_count = :count where id = :id&quot;
* <p>
* <pre>{@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(&quot;id&quot;, 1);
* update.setParameter(&quot;count&quot;, 50);
*
* update.setParameter("id", 1);
* update.setParameter("count", 50);
*
* int modifiedCount = Ebean.execute(update);
*
* String msg = &quot;There were &quot; + modifiedCount + &quot; rows updated&quot;
* </pre>
*
*
* String msg = "There were " + modifiedCount + " rows updated";
*
* }</pre>
*
* @see Update
* @see SqlQuery
* @see CallableSql
@@ -47,7 +49,7 @@ public interface SqlUpdate {
* {@link Transaction#setBatchMode(boolean)} and
* {@link Transaction#setBatchSize(int)}.
* </p>
*
*
* @see com.avaje.ebean.Ebean#execute(SqlUpdate)
*/
int execute();
+30 -33
View File
@@ -62,10 +62,10 @@ public interface Transaction extends Closeable {
* </p>
* <h3>Functions/h3>
* <ul>
* <li>Flush the JDBC batch buffer</li>
* <li>Call commit on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Perform post-commit processing updating L2 cache, ElasticSearch etc</li>
* <li>Flush the JDBC batch buffer</li>
* <li>Call commit on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Perform post-commit processing updating L2 cache, ElasticSearch etc</li>
* </ul>
*/
void commitAndContinue() throws RollbackException;
@@ -78,12 +78,12 @@ public interface Transaction extends Closeable {
* </p>
* <h3>Functions/h3>
* <ul>
* <li>Flush the JDBC batch buffer</li>
* <li>Call commit on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Perform post-commit processing updating L2 cache, ElasticSearch etc</li>
* <li>Close any underlying resources, closing the underlying JDBC connection</li>
* <li>Mark the transaction as "Inactive"</li>
* <li>Flush the JDBC batch buffer</li>
* <li>Call commit on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Perform post-commit processing updating L2 cache, ElasticSearch etc</li>
* <li>Close any underlying resources, closing the underlying JDBC connection</li>
* <li>Mark the transaction as "Inactive"</li>
* </ul>
*/
void commit() throws RollbackException;
@@ -95,10 +95,10 @@ public interface Transaction extends Closeable {
* </p>
* <h3>Functions/h3>
* <ul>
* <li>Call rollback on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Close any underlying resources, closing the underlying JDBC connection</li>
* <li>Mark the transaction as "Inactive"</li>
* <li>Call rollback on the underlying JDBC connection</li>
* <li>Trigger any registered TransactionCallbacks</li>
* <li>Close any underlying resources, closing the underlying JDBC connection</li>
* <li>Mark the transaction as "Inactive"</li>
* </ul>
*/
void rollback() throws PersistenceException;
@@ -136,10 +136,10 @@ public interface Transaction extends Closeable {
/**
* Set the behavior for document store updates on this transaction.
* <p>
* 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.
* </p>
*/
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.
* <p>
* 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.
* </p>
* <p>
* Setting this overrides the default of {@link DocStoreConfig#getBulkBatchSize()}
* Setting this overrides the default of {@link DocStoreConfig#getBulkBatchSize()}
* </p>
*/
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.
* </p>
*
* <p>
* <pre>{@code
*
* // assume Customer has L2 bean caching enabled ...
@@ -279,23 +279,23 @@ public interface Transaction extends Closeable {
* <p>
* Example: batch processing executing every 3 rows
* </p>
*
* <p>
* <pre>{@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();
* }
*
* }</pre>
*
*/
void setBatchMode(boolean useBatch);
@@ -325,7 +324,6 @@ public interface Transaction extends Closeable {
* </p>
*
* @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 {
* </p>
*
* @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);
+12 -10
View File
@@ -12,24 +12,26 @@ package com.avaje.ebean;
* <p>
* See also {@link TxRunnable}.
* </p>
*
* <pre class="code">
* Ebean.execute(new TxCallable&lt;String&gt;() {
* <p>
* <pre>{@code
*
* Ebean.execute(new TxCallable<String>() {
* public String call() {
* User u1 = Ebean.find(User.class, 1);
* User u2 = Ebean.find(User.class, 2);
*
* u1.setName(&quot;u1 mod&quot;);
* u2.setName(&quot;u2 mod&quot;);
*
*
* u1.setName("u1 mod");
* u2.setName("u2 mod");
*
* Ebean.save(u1);
* Ebean.save(u2);
*
*
* return u1.getEmail();
* }
* });
* </pre>
*
*
* }</pre>
*
* @see TxRunnable
*/
public interface TxCallable<T> {
+15 -15
View File
@@ -12,7 +12,7 @@ import java.sql.Connection;
* This can be used with TxScope to define transactional scopes to execute
* method within.
* </p>
*
*
* @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);
}
}
+11 -10
View File
@@ -8,26 +8,27 @@ package com.avaje.ebean;
* <p>
* See also {@link TxCallable}.
* </p>
*
* <pre class="code">
*
* <p>
* <pre>{@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(&quot;u1 mod&quot;);
* u2.setName(&quot;u2 mod&quot;);
*
*
* u1.setName("u1 mod");
* u2.setName("u2 mod");
*
* Ebean.save(u1);
* Ebean.save(u2);
* }
* });
* </pre>
*
*
* }</pre>
*
* @see TxCallable
*/
public interface TxRunnable {
+1 -2
View File
@@ -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 + "]";
}
/**
+1 -1
View File
@@ -8,7 +8,7 @@ package com.avaje.ebean;
* {@link Ebean#execute(TxScope, TxCallable)} and
* {@link Ebean#execute(TxScope, TxRunnable)}.
* </p>
*
*
* @see TxScope
*/
public enum TxType {
+43 -52
View File
@@ -11,43 +11,43 @@ package com.avaje.ebean;
* <p>
* The following is an example of named updates on an entity bean.
* </p>
*
* <pre type="class">
* <pre>{@code
* ...
* &#064;NamedUpdates(value = {
* &#064;NamedUpdate(
* name = &quot;setTitle&quot;,
* notifyCache = false,
* update = &quot;update topic set title = :title, postCount = :count where id = :id&quot;),
* &#064;NamedUpdate(
* name = &quot;setPostCount&quot;,
* notifyCache = false,
* update = &quot;update f_topic set post_count = :postCount where id = :id&quot;),
* &#064;NamedUpdate(
* name = &quot;incrementPostCount&quot;,
* notifyCache = false,
* update = &quot;update Topic set postCount = postCount + 1 where id = :id&quot;)
* //update = &quot;update f_topic set post_count = post_count + 1 where id = :id&quot;)
* @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")
* })
* &#064;Entity
* &#064;Table(name = &quot;f_topic&quot;)
* @Entity
* @Table(name = "f_topic")
* public class Topic {
* ...
* </pre>
*
* }</pre>
*
* <p>
* The following show code that would use a named update on the Topic entity
* bean.
* </p>
*
* <pre class="code">
* Update&lt;Topic&gt; update = Ebean.createUpdate(Topic.class, &quot;incrementPostCount&quot;);
* update.setParameter(&quot;id&quot;, 1);
* <p>
* <pre>{@code
*
* Update<Topic> update = Ebean.createUpdate(Topic.class, "incrementPostCount");
* update.setParameter("id", 1);
* int rows = update.execute();
* </pre>
*
* @param <T>
* the type of entity beans inserted updated or deleted
*
* }</pre>
*
* @param <T> the type of entity beans inserted updated or deleted
*/
public interface Update<T> {
@@ -73,9 +73,8 @@ public interface Update<T> {
* preparedStatement. If the timeout occurs an exception will be thrown - this
* will be a SQLException wrapped up in a PersistenceException.
* </p>
*
* @param secs
* the timeout in seconds. Zero implies unlimited.
*
* @param secs the timeout in seconds. Zero implies unlimited.
*/
Update<T> setTimeout(int secs);
@@ -92,21 +91,17 @@ public interface Update<T> {
* <p>
* Set a value for each ? you have in the sql.
* </p>
*
* @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<T> 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<T> setParameter(int position, Object value);
@@ -129,11 +124,9 @@ public interface Update<T> {
* <p>
* A more succinct version of setParameter() to be consistent with Query.
* </p>
*
* @param name
* the parameter name.
* @param value
* the parameter value.
*
* @param name the parameter name.
* @param value the parameter value.
*/
Update<T> set(String name, Object value);
@@ -148,11 +141,9 @@ public interface Update<T> {
* <p>
* A more succinct version of setNullParameter().
* </p>
*
* @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<T> setNull(String name, int jdbcType);
@@ -166,4 +157,4 @@ public interface Update<T> {
*/
String getGeneratedSql();
}
}
+12 -16
View File
@@ -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.
* </p>
*
* <p>
* <h4>Example: Simple update</h4>
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -26,18 +26,17 @@ package com.avaje.ebean;
* update o_customer set status=?, updtime=? where id > ?
*
* }</pre>
*
* <p>
* Note that if the where() clause contains a join then the SQL update changes to use a
* <code> WHERE ID IN () </code> form.
* </p>
*
* <p>
* <h4>Example: Update with a JOIN</h4>
* <p>
* In this example the expression <code>.eq("billingAddress.country", nz)</code> requires a join
* to the address table.
* In this example the expression <code>.eq("billingAddress.country", nz)</code> requires a join
* to the address table.
* </p>
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -50,7 +49,7 @@ package com.avaje.ebean;
* .gt("id", 1000)
* .update();
* }</pre>
*
* <p>
* <pre>{@code sql
*
* update o_customer set status=?, updtime=?
@@ -65,15 +64,13 @@ package com.avaje.ebean;
* }</pre>
*
* @param <T> The type of entity bean being updated
*
* @see SqlUpdate
*/
public interface UpdateQuery<T> {
/**
* Set the value of a property.
*
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -87,13 +84,13 @@ public interface UpdateQuery<T> {
* }</pre>
*
* @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<T> set(String property, Object value);
/**
* Set the property to be null.
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -110,12 +107,11 @@ public interface UpdateQuery<T> {
UpdateQuery<T> setNull(String property);
/**
*
* Set using a property expression that does not need any bind values.
* <p>
* The property expression typically contains database functions.
* </p>
*
* <p>
* <pre>{@code
*
* int rows = ebeanServer
@@ -148,7 +144,7 @@ public interface UpdateQuery<T> {
* }</pre>
*
* @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<T> setRaw(String propertyExpression, Object... values);
+1 -1
View File
@@ -29,7 +29,7 @@ public class ValuePair {
public Object getNewValue() {
return newValue;
}
/**
* Return the old value.
*/
+37 -37
View File
@@ -1,6 +1,6 @@
<html>
<head>
<title>Ebean API</title>
<title>Ebean API</title>
</head>
<body BGCOLOR="#ffffff">
Ebean Object Relational Mapping (start at
@@ -9,48 +9,48 @@ Ebean Object Relational Mapping (start at
<h3>Ebean</h3>
<p>
Provides the main API for fetching and persisting beans with Ebean.
Provides the main API for fetching and persisting beans with Ebean.
</p>
<p>
For a full description of the query language refer to <a href="com/avaje/ebean/Query.html">Query</a>.
For a full description of the query language refer to <a href="com/avaje/ebean/Query.html">Query</a>.
</p>
<p>
&nbsp;
&nbsp;
</p>
<div id="overviewexamples">
<h3>
EXAMPLE 1: Simple fetch
</h3>
<pre>{@code
<h3>
EXAMPLE 1: Simple fetch
</h3>
<pre>{@code
// fetch order 10
Order order = Ebean.find(Order.class, 10);
}</pre>
<h3>
EXAMPLE 2: Fetch an Object with associations
</h3>
<pre>{@code
<h3>
EXAMPLE 2: Fetch an Object with associations
</h3>
<pre>{@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();
}</pre>
<h3>
EXAMPLE 3: Fetch a list of Objects with associations
</h3>
<pre>{@code
<h3>
EXAMPLE 3: Fetch a list of Objects with associations
</h3>
<pre>{@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<Order> orderList = Ebean.find(Order.class);
.fetch("customer")
@@ -62,14 +62,14 @@ List<Order> 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<OrderDetail> details = order.getDetails();
@@ -79,10 +79,10 @@ String productName = product.getName();
}</pre>
<h3>
EXAMPLE 4: Create and save an Order
</h3>
<pre>{@code
<h3>
EXAMPLE 4: Create and save an Order
</h3>
<pre>{@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);
}</pre>
<h3>
EXAMPLE 5: Use another database
</h3>
<pre>{@code
<h3>
EXAMPLE 5: Use another database
</h3>
<pre>{@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);
}</pre>
</div>
</body>
</html>
</html>
+3 -3
View File
@@ -1,13 +1,13 @@
<HTML>
<HEAD>
<TITLE>Ebean core API</TITLE>
<TITLE>Ebean core API</TITLE>
</HEAD>
<Body BGCOLOR="#ffffff">
Core API (see <a href="EbeanServer.html">EbeanServer</a> and <a href="Ebean.html">Ebean</a>).
<h3>Ebean</h3>
<p>
Provides the main API for fetching and persisting beans with eBean.
Provides the main API for fetching and persisting beans with eBean.
</p>
<pre>{@code
@@ -83,4 +83,4 @@ hrServer.save(contact);
}</pre>
</Body>
</HTML>
</HTML>
+71 -22
View File
@@ -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;
}