Return-Path: X-Original-To: apmail-cayenne-commits-archive@www.apache.org Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DCC3EDEF8 for ; Fri, 9 Nov 2012 07:31:18 +0000 (UTC) Received: (qmail 92629 invoked by uid 500); 9 Nov 2012 07:31:18 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 92582 invoked by uid 500); 9 Nov 2012 07:31:17 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 92538 invoked by uid 99); 9 Nov 2012 07:31:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 07:31:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 07:30:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D2A042388C6A for ; Fri, 9 Nov 2012 07:30:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r837766 [12/23] - in /websites/staging/cayenne/trunk/content: ./ docs/ docs/1.2/ docs/2.0/ docs/3.0/ docs/3.1/ Date: Fri, 09 Nov 2012 07:29:36 -0000 To: commits@cayenne.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121109073003.D2A042388C6A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: websites/staging/cayenne/trunk/content/docs/2.0/moving-objects-between-contexts.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/moving-objects-between-contexts.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/moving-objects-between-contexts.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Moving Objects Between Contexts + + + +Apache Cayenne » 2.0 » Moving Objects Between Contexts + + + + + + + + + +
- + + +
+ + + + + +
+
+

Each instance of a DataObject belongs to only one DataContext for the duration of the object lifecycle. Sometimes there maybe a need to transfer a list of objects from one DataContext to another. The goal of this operation is to be able to use such objects in relationships with objects of the target DataContext. Most common use for this feature is the following. An application may have a "shared" DataContext that is used to fetch "static" read only lookup data. To avoid fetching the same data over and over again for each session, objects from the shared DataContext can be transferred to a session DataContext by calling DataContext.localObject():

@@ -22,3 +69,12 @@ User user; // user.setUserType(localType); ...
+ +
+
+
+ + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/namedquery.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/namedquery.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/namedquery.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » NamedQuery + + + +Apache Cayenne » 2.0 » NamedQuery + + + + + + + + + +
- + + +
+ + + + + +
+
+

NamedQuery is a query that is a reference to another query stored in the DataMap. It can hold named parameters that will be passed to the named query on execution.

@@ -14,3 +61,12 @@ NamedQuery query = Copyright © 2001-2012 Apache Software Foundation. Apache Cayenne, Cayenne, Apache, the Apache feather logo, and the Apache Cayenne project logo are trademarks of The Apache Software Foundation. Privacy policy. +
+
+ +
+ + Modified: websites/staging/cayenne/trunk/content/docs/2.0/nested-datacontexts.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/nested-datacontexts.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/nested-datacontexts.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Nested DataContexts - - + + + +Apache Cayenne » 2.0 » Nested DataContexts + + + + + + + + + +
+ + + +
+ + + + + +
+
+

One of the goals of the DataContext is to provide an isolated area where local object changes can be performed without affecting other similar areas or the underlying storage. At some point in time users would either commit changes to the underlying storage or undo them (roll them back).

@@ -45,3 +92,12 @@ DataContext child = context.createChildD

Nested DataContexts Performance

All cascading operations (such as a select query or a cascading update) initiated by a nested DataContext will have to travel through the stack of parent contexts, incurring certain delay at each stack level. The delay is due to the fact that each DataContext has to update its own objects during most operations. So nesting should only be used when application specifics require to do so. Also nesting of more than a few levels should be avoided.

+ +
+
+
+ +
+ + Modified: websites/staging/cayenne/trunk/content/docs/2.0/new-system.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/new-system.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/new-system.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » New System - - + + + +Apache Cayenne » 2.0 » New System + + + + + + + + + +
+ + + +
+ + + + + +
+
+

New System

@@ -14,3 +61,12 @@ Title: 2.0 » New System
  • Generate Java Classes
  • + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/null-handling.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/null-handling.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/null-handling.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » NULL Handling + + + +Apache Cayenne » 2.0 » NULL Handling + + + + + + + + + +
    - + + +
    + + + + + +
    +
    +

    Handling of Java nulls as operands is no different from normal values. Instead of using special conditional operators, like SQL does, EQUAL_TO and NOT_EQUAL_TO expressions can be used directly with null values. It is up to Cayenne to translate expressions with nulls to the valid SQL.

    @@ -12,3 +59,12 @@ Title: 2.0 » NULL Handling Expression exp = ExpressionFactory.noMatchExp("birthDate", null);
    + +
    +
    +
    + + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/object-caching.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/object-caching.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/object-caching.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Object Caching - - + + + +Apache Cayenne » 2.0 » Object Caching + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Cayenne implements an advanced caching mechanism that has a goal of improving application performance and ensuring data consistency both across Java applications and sessions within the same application. The following classes participate in the caching mechanism:

    @@ -66,3 +113,12 @@ domain.getEventManager().addListener(
  • Due to concurrency issues discussed above, if a snapshot version conflict occurs, DataRowStore removes a given snapshot from the cache to avoid dealing with concurrency effects on merging.
  • + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/objectcontext.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/objectcontext.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/objectcontext.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,62 @@ -Title: 2.0 » ObjectContext + + + +Apache Cayenne » 2.0 » ObjectContext + + + + + + + + + +
    - + + +
    + + + + + +
    +
    +

    org.apache.cayenne.ObjectContext is an interface that defines API for the application interaction with Cayenne. Two most notable implementors are DataContext, used in most Cayenne applications, and CayenneContext used on the remote client.

    ObjectContext accesses the underlying persistence stack via a parent DataChannel. ObjectContexts that support multiple levels of nesting (such as DataContext) themselves implement a org.apache.cayenne.DataChannel interface.

    + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/objectidquery.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/objectidquery.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/objectidquery.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » ObjectIdQuery - - + + + +Apache Cayenne » 2.0 » ObjectIdQuery + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    (DataObjectUtils API below is available since 1.2M10. SingleObjectQuery, a precursor of ObjectIdQuery, was available since 1.2M9. In 1.2M12 SingleObjectQuery was renamed to ObjectIdQuery)

    @@ -59,3 +106,12 @@ Artist object = (Artist) DataObjectUtils }
    + +
    +
    +
    + + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/obtaining-datacontext.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/obtaining-datacontext.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/obtaining-datacontext.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Obtaining DataContext - - + + + +Apache Cayenne » 2.0 » Obtaining DataContext + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Depending on deployment environment and application needs, Cayenne can be configured in a few different ways to make DataContext instances available. This is discussed in detail in deployment chapter. In this chapter we assume a properly deployed application and will concentrate on how to obtain a DataContext for the database access. The following are the most common ways to achieve that:

    Creating DataContext on the Spot

    @@ -76,3 +123,12 @@ DataContext context = ServletUtil.getSes String domainName = ...; DataContext context = DataContext.createDataContext(domainName);
    + +
    +
    +
    + + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/orm-case-study.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/orm-case-study.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/orm-case-study.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » ORM Case Study - - + + + +Apache Cayenne » 2.0 » ORM Case Study + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    This chapter shows how ORM (Object Relational Modeling) approach should be chosen based on the project requirements and other factors. It contains links to technical aspects of modeling that are discussed elsewhere. A few scenarios are shown below that describe the most common cases that a development team may encounter on a typical O/R project. Lets assume an imaginary company called "Some Company" that sells services to consumers as its main business, but also sells consumer products, and works with business customers. There are a number of project teams working on a set of Object/Relational projects.

    Project 1: Java Interface to an Existing Database

    @@ -24,3 +71,12 @@ Title: 2.0 » ORM Case Study + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/paginated-queries.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/paginated-queries.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/paginated-queries.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Paginated Queries - - + + + +Apache Cayenne » 2.0 » Paginated Queries + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Another common situation found in interactive applications is when it is needed to fetch a large number of rows, and at the same time only a small subset of objects is accessed directly. An example of such application would be a search page. User would like to see how many total results exist that match a certain criteria, but she will only look at a few pages of results out of possibly hundreds or thousands. It will be extremely inefficient to fetch all objects in the memory.

    A solution offered by Cayenne is "paginated" queries. A user can set a size of a "page" of a select query. If page size is greater than zero, on query execution Cayenne will only fetch the first "page" as DataObjects. For the rest of the result set, only primary keys are read. When a user accesses an object that has not been resolved yet, the whole page containing this object will be resolved all at once. Most important, this happens totally transparent to the user.

    @@ -43,3 +90,12 @@ q.setPageSize(50);
    Combining data rows and paginated queries
    Cayenne supports combining both performance optimizations in the same query - fetching data rows (see previous chapters) and paginated queries. So if users work with tabular data and don't care much about real objects, combining the two approaches would improve speed and memory use even more.
    + +
    +
    +
    + + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/parameterized-queries.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/parameterized-queries.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/parameterized-queries.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Parameterized Queries - - + + + +Apache Cayenne » 2.0 » Parameterized Queries + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    SelectQuery objects can be rather complex. They may contain long qualifiers and lots of tuning parameters. Parameterized Queries feature addresses reusability of complex queries. With this feature, for each group of queries that differ only in the values used in the qualifier, a developer may create a single shared "prototype" or "template" query, and use it later as a factory for other queries. All settings configured in the prototype object will be passed to the final queries. Qualifier of the prototype query may use named parameters that are substituted for real values when a final query is created from the prototype.

    "Prototype" queries are normally created in CayenneModeler and stored in the DataMap XML file. "Queries Stored in DataMap" chapter describes how to use such templates. This chapter shows how to create them on the spot using the API calls.
    @@ -78,3 +125,12 @@ SelectQuery query2 = proto.queryWithPara ...
    + +
    +
    +
    + + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/path-expressions.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/path-expressions.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/path-expressions.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Path Expressions - - + + + +Apache Cayenne » 2.0 » Path Expressions + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Before we start discussing how to build expressions, it is important to understand one group of expressions widely used in Cayenne: path expressions. There are two types of path expressions: object path used to navigate graphs of Java objects that follow Java Bean property naming conventions and database path used to navigate the database schema.

    @@ -33,3 +80,12 @@ Title: 2.0 » Path Expressions

    Matching Path Expressions

    As described in the following chapters a path expression is usually matched against some value (see for example ExpressionFactory API - the first argument to each method is a path, and a second - an Object value that is matched against the path). Such value type must be compatible with the type of the property pointed to by the path. E.g. toArtist.artistName can only be matched against a String, and toArtist - against instances of Artist.

    + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/performance-tuning.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/performance-tuning.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/performance-tuning.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Performance Tuning - - + + + +Apache Cayenne » 2.0 » Performance Tuning + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Most performance problems in database applications, including those using ORM, are related to the inefficient queries and/or large volumes of data in the database. Here is a few common issues that a typical application may run into:

      @@ -23,3 +70,12 @@ Title: 2.0 » Performance Tuning
    • Turning off Context Synchronization
    • + +
      +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/persistent-object-lifecycle.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/persistent-object-lifecycle.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/persistent-object-lifecycle.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Persistent Object Lifecycle + + + +Apache Cayenne » 2.0 » Persistent Object Lifecycle + + + + + + + + + +
    - + + +
    + + + + + +
    +
    +

    A lifecycle of a persistent object can be represented as a number of states and transitions between them. These states are formally defined as "int" constants in org.apache.cayenne.PersistenceState class. Transitions between states (see the diagram below) occur in response to the application interacting with either persistent objects or Cayenne context. Whenever a transition occurs, Cayenne automatically updates "persistenceState" property of all affected objects by calling setPersistenceState().

    @@ -11,3 +58,12 @@ Title: 2.0 » Persistent Object Lif

    A feteched or committed object state transformations:

    + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/preferences-panel.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/preferences-panel.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/preferences-panel.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Preferences Panel - - + + + +Apache Cayenne » 2.0 » Preferences Panel + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    CayenneModeler relies on a number of user-specific preferences to operate in a user-friendly manner. Some preferences are determined automatically behind the scenes (such as preferred window size or last visited directory), some can be configured by users via "Preferences Panel" described in this chapter.

    Preferences are saved and retrieved using Cayenne on top of embedded HSQL database. The actual preferences data is stored as a set of SQL commands in a flat file under Cayenne user directory.

    @@ -22,3 +69,12 @@ Title: 2.0 » Preferences Panel + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/prefetching.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/prefetching.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/prefetching.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Prefetching - - + + + +Apache Cayenne » 2.0 » Prefetching + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Introduction to Prefetching

    Prefetching is a performance optimization technique that allows to bring back more than one type of objects in a single query. Prefetches are configured in terms of relationship paths from the query root entity to the "prefetched" entity. E.g.:

    @@ -127,3 +174,12 @@ context.performQuery(query);

    Code above will result in a single SQL statement issued.

    + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/primary-key-generation.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/primary-key-generation.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/primary-key-generation.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Primary Key Generation - -

    Depending on the type of persistent objects and the database design, primary key values can be handled in a few different ways. A decision to use one or another technique will affect how the mapping is done. Here is a summary of possible scenarios. Each one is described below in details.

    + + + +Apache Cayenne » 2.0 » Primary Key Generation + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Depending on the type of persistent objects and the database design, primary key values can be handled in a few different ways. A decision to use one or another technique will affect how the mapping is done. Here is a summary of possible scenarios. Each one is described below in details.

    @@ -74,3 +121,12 @@ Title: 2.0 » Primary Key Generatio
  • Generated Columns
  • + +
    +
    This chapter is dedicated to the use of expressions as qualifiers. A detailed discussion on expressions in general is provided at Expressions.
    @@ -19,3 +66,12 @@ Title: 2.0 » Qualifier Expressions Adding an expression to an already existing qualifier using logical OR. + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/queries-stored-in-datamap.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/queries-stored-in-datamap.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/queries-stored-in-datamap.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Queries Stored in DataMap + + + +Apache Cayenne » 2.0 » Queries Stored in DataMap + + + + + + + + + +
    - + + +
    + + + + + +
    +
    +

    To facilitate reuse of queries users can assign symbolic names to them and store such named queries in a DataMap. Normally this is done by creating a query in CayenneModeler. Storing queries in a DataMap reduces the amount of code and speeds up query creation process.

    @@ -30,3 +77,12 @@ SelectQuery query = prototype.queryWithP List objects = context.performQuery("MySelect", false);
    + +
    +
    +
    + + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/queries.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/queries.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/queries.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Queries - -

    Queries are Cayenne abstraction for communicating with an external data storage. Queries are Java objects that are generally independent from the SQL dialect used by the target database. Cayenne includes a number of standard queries in the org.apache.cayenne.query package. Many of them are only used internally. Here we describe the queries that can be useful in the application.

    + + + +Apache Cayenne » 2.0 » Queries + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Queries are Cayenne abstraction for communicating with an external data storage. Queries are Java objects that are generally independent from the SQL dialect used by the target database. Cayenne includes a number of standard queries in the org.apache.cayenne.query package. Many of them are only used internally. Here we describe the queries that can be useful in the application.

    General Purpose Queries

    @@ -46,3 +93,12 @@ Title: 2.0 » Queries + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/querychain.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/querychain.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/querychain.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » QueryChain + + + +Apache Cayenne » 2.0 » QueryChain + + + + + + + + + +
    - + + +
    + + + + + +
    +
    +

    QueryChain, as the name implies, is a Query that is itself a collection of other queries. It simplifies an execution of multiple queries in a single batch. E.g.:

    @@ -13,3 +60,12 @@ DataContext context = ... context.performNonSelectingQuery(query);
    + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/quick-start.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/quick-start.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/quick-start.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Quick Start + + + +Apache Cayenne » 2.0 » Quick Start + + + + + + + + + +
    - + + +
    + + + + + +
    +
    +

    This chapter provides a step-by-step tutorial on writing a full database application with Cayenne. When you are done with it, you should have an understanding of the basics of object relational mapping with CayenneModeler and how to use Cayenne in standalone (command line or otherwise) and web applications. The tutorial uses the Eclipse IDE (since it is free and very common) and Derby database (since it supports embedded mode and thus requires zero setup), however it can be easily applied to any other database and/or IDE's.

    Full tutorial source code in a form of Eclipse project is distributed with Cayenne (see "src/tutorials/quick-start" folder).

    @@ -28,3 +75,12 @@ Title: 2.0 » Quick Start
  • Converting to web application...
  • + +
    +
    +
    + +
    + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/relationshipquery.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/relationshipquery.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/relationshipquery.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » RelationshipQuery + + + +Apache Cayenne » 2.0 » RelationshipQuery + + + + + + + + + +
    - + + +
    + + + + + +
    +
    +

    RelationshipQuery is used by Cayenne internally to fetch object(s) related to a single given object via a mapped ObjRelationship. In some cases the query can be used directly in the application, e.g. if we want to refresh related objects.

    @@ -9,3 +56,12 @@ Title: 2.0 » RelationshipQuery RelationshipQuery query = new RelationshipQuery(id, "paintingArray", true); List paintings = context.performQuery(query);
    + +
    +
    +
    + + + + Modified: websites/staging/cayenne/trunk/content/docs/2.0/relationships.html ============================================================================== --- websites/staging/cayenne/trunk/content/docs/2.0/relationships.html (original) +++ websites/staging/cayenne/trunk/content/docs/2.0/relationships.html Fri Nov 9 07:29:01 2012 @@ -1,6 +1,53 @@ -Title: 2.0 » Relationships - - + + + +Apache Cayenne » 2.0 » Relationships + + + + + + + + + +
    + + + +
    + + + + + +
    +
    +

    Relationships are special DataObject properties that reference other "related" objects. Semantically there are two types of relationships - to-one pointing to just a single DataObjects (e.g. Painting.toArtist), and to-many pointing to a collection of DataObjects of the same base type (e.g. Artist.paintingArray).

    To-One Relationships

    @@ -45,3 +92,12 @@ artist.addToPaintingArray(newPainting);
    While to-many relationships in Cayenne are represented by Lists, they are really ordered Sets, as they are not allowed to contain the same object more than once.
    + +
    +
    +
    + + + +