blob: 4f464ce0075317630720e0eed477b55dee181e60 [file] [log] [blame]
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
title: DataObjects
url: /docs/2.0/dataobjects.html
layout: docs_legacy
---
<P>DataObjects (Cayenne persistent objects) are composed of attributes and relationships. Attributes are the simplest object properties (as in &quot;java bean properties&quot;) that can be stored in the columns in the database. Those are usually string, numeric, binary or date values. Another type of properties is relationships. They represent related DataObjects (to-one relationships) or collections of DataObjects (to-many relationships). To read and modify attributes and relationships, application code would simply invoke corresponding get or set methods. In case of to-many relationships represented by collections there are also add and remove methods.</P>
<P>Queries discussed in the previous chapter are used to obtain the initial sets of DataObjects. After that a graph of persistent objects is navigated and modified via relationship methods, thus hiding the underlying relational storage complexity and giving application a nice object view of the relevant subset of the database data.</P>
<P>Examples of working with attributes and relationships are given later in this chapter.</P>
<H3><A name="DataObjects-Sections"></A>Sections</H3>
<OL>
<LI><A href="relationships.html" title="Relationships">Relationships</A></LI>
<LI><A href="flattened-relationships.html" title="Flattened Relationships">Flattened Relationships</A></LI>
<LI><A href="dataobjects-example.html" title="DataObjects Example">DataObjects Example</A></LI>
<LI><A href="accessing-pk-and-fk-values.html" title="Accessing PK and FK values">Accessing PK and FK values</A></LI>
<LI><A href="dataobjectutils.html" title="DataObjectUtils">DataObjectUtils</A></LI>
<LI><A href="dataobject-validation.html" title="DataObject Validation">DataObject Validation</A></LI>
<LI><A href="handling-inheritance.html" title="Handling Inheritance">Handling Inheritance</A></LI>
<LI><A href="deleting-objects.html" title="Deleting Objects">Deleting Objects</A></LI>
<LI><A href="generic-persistent-class.html" title="Generic Persistent Class">Generic Persistent Class</A></LI>
</OL>