Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne
Class DataRow

    java.lang.Object
      java.util.AbstractMap<K,V>
          java.util.HashMap
              org.apache.cayenne.DataRow

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.util.Map

    public class DataRow

extends java.util.HashMap

DataRow a map that holds values retrieved from the database for a given query row. DataRows are used to cache raw database data and as a reference point for tracking DataObject changes.

Since:
  1.1
Author:
  Andrus Adamchik
See Also:
  Serialized Form

Field Summary
`protected long` | `replacesVersion`
`protected long` | `version`

Constructor Summary
`DataRow(int initialCapacity)`
`DataRow(java.util.Map map)`

Method Summary
`DataRow` | `applyDiff(DataRow diff)` Builds a new DataRow, merging changes from `diff` parameter with data contained in this DataRow.
`DataRow` | `createDiff(DataRow row)` Creates a DataRow that contains only the keys that have values that differ between this object and `row` parameter.
`ObjectId` | `createObjectId(java.lang.Class objectClass, DbEntity entity)` Deprecated. since 1.2, as new portable ObjectIds can't store Java Class and store entity name instead. Now this method relies on default CayenneModeler naming convention to figure out entity name from class name. This may not work if the classes where mapped differently.
`ObjectId` | `createObjectId(ObjEntity entity)` Creates an ObjectId from the values in the snapshot.
`ObjectId` | `createObjectId(java.lang.String entityName, DbEntity entity)`
`ObjectId` | `createObjectId(java.lang.String entityName, DbEntity entity, java.lang.String namePrefix)` Extracts PK columns prefixed with some path.
`ObjectId` | `createTargetObjectId(java.lang.Class targetClass, DbRelationship relationship)` Deprecated. since 1.2, as new portable ObjectIds can't store Java Class and store entity name instead. Now this method relies on default CayenneModeler naming convention to figure out entity name from class name. This may not work if the classes where mapped differently.
`ObjectId` | `createTargetObjectId(java.lang.String entityName, DbRelationship relationship)` Returns an ObjectId of an object on the other side of the to-one relationship, for this DataRow representing a source of relationship.
`long` | `getReplacesVersion()`
`long` | `getVersion()`
`void` | `setReplacesVersion(long replacesVersion)` Sets the version of DataRow replaced by this one in the store.
`java.lang.String` | `toString()`

Methods inherited from class java.util.HashMap
`clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values`

Methods inherited from class java.util.AbstractMap
`equals, hashCode`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Field Detail

### version

    protected long version

### replacesVersion

    protected long replacesVersion

Constructor Detail

### DataRow

    public DataRow(java.util.Map map)

### DataRow

    public DataRow(int initialCapacity)

Method Detail

### getVersion

    public long getVersion()

### getReplacesVersion

    public long getReplacesVersion()

### setReplacesVersion

    public void setReplacesVersion(long replacesVersion)

  Sets the version of DataRow replaced by this one in the store.

### applyDiff

    public DataRow applyDiff(DataRow diff)

  Builds a new DataRow, merging changes from `diff` parameter with data contained in this DataRow.

### createDiff

    public DataRow createDiff(DataRow row)

  Creates a DataRow that contains only the keys that have values that differ between this object and `row` parameter. Diff values are taken from the `row` parameter. It is assumed that key sets are compatible in both rows (e.g. they represent snapshots for the same entity). Returns null if no differences are found.

### createObjectId

    public ObjectId createObjectId(ObjEntity entity)

  Creates an ObjectId from the values in the snapshot. If needed attributes are missing in a snapshot, CayenneRuntimeException is thrown.

### createObjectId

    public ObjectId createObjectId(java.lang.Class objectClass,
                                   DbEntity entity)

  Deprecated. since 1.2, as new portable ObjectIds can't store Java Class and store entity name instead. Now this method relies on default CayenneModeler naming convention to figure out entity name from class name. This may not work if the classes where mapped differently.

### createTargetObjectId

    public ObjectId createTargetObjectId(java.lang.Class targetClass,
                                         DbRelationship relationship)

  Deprecated. since 1.2, as new portable ObjectIds can't store Java Class and store entity name instead. Now this method relies on default CayenneModeler naming convention to figure out entity name from class name. This may not work if the classes where mapped differently.

### createObjectId

    public ObjectId createObjectId(java.lang.String entityName,
                                   DbEntity entity)

### createTargetObjectId

    public ObjectId createTargetObjectId(java.lang.String entityName,
                                         DbRelationship relationship)

  Returns an ObjectId of an object on the other side of the to-one relationship, for this DataRow representing a source of relationship. Returns null if snapshot FK columns indicate a null to-one relationship.

### createObjectId

    public ObjectId createObjectId(java.lang.String entityName,
                                   DbEntity entity,
                                   java.lang.String namePrefix)

  Extracts PK columns prefixed with some path. If namePrefix is null or empty, no prefixing is done.

  Prefixing is useful when extracting an ObjectId of a target row from a row obtained via prefetching. namePrefix must omit the "db:" prefix and must end with ".", e.g. "TO_ARTIST.PAINTING_ARRAY."

  Since:
    1.2

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.util.AbstractMap`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.