Package org.apache.cayenne.map
Class DbEntity
- All Implemented Interfaces:
- Serializable,- EventListener,- ConfigurationNode,- DbAttributeListener,- DbEntityListener,- DbRelationshipListener,- CayenneMapEntry,- XMLSerializable
public class DbEntity
extends Entity<DbEntity,DbAttribute,DbRelationship>
implements ConfigurationNode, DbEntityListener, DbAttributeListener, DbRelationshipListener  
A DbEntity is a mapping descriptor that defines a structure of a database
 table.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Stringprotected Collection<DbAttribute>protected List<DbAttribute>protected DbKeyGeneratorprotected ExpressionQualifier, that will be applied to all select queries and joins with this DbEntityprotected StringFields inherited from class org.apache.cayenne.map.Entityattributes, dataMap, name, OUTER_JOIN_INDICATOR, PATH_SEPARATOR, relationships
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription<T> TacceptVisitor(ConfigurationNodeVisitor<T> visitor) voidaddAttribute(DbAttribute attr) Adds a new attribute to this entity.voidvoidNew attribute has been created/added.voidAttribute property changed.voidAttribute has been removed.voidNew entity has been created/added.voidDbEntity property changed event.voidEntity has been removed.voidRelationship has been created/added.voidRelationship property changed.voidRelationship has been removed.voidencodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate) Prints itself as XML to the provided XMLEncoder.Returns the catalog name of the table described by this DbEntity.Returns table name including catalog and schema, if any of those are present.Returns an unmodifiable collection of DbAttributes that are generated by the database.Return the primary key generator for this entity.Returns an unmodifiable collection of DbAttributes representing the primary key of the table described by this DbEntity.Returns database schema of this table.booleanReturns true if there is full replacement id is attached to an ObjectId.voidremoveAttribute(String attrName) Removes attribute from the entity, removes any relationship joins containing this attribute.resolvePath(Expression pathExp, Map<String, String> aliasMap) Returns an Iterable instance over expression path components based on this entity.resolvePathComponents(Expression pathExp) Processes expressionpathExpand returns an Iterator of path components that contains a sequence of Attributes and Relationships.voidsetCatalog(String catalog) Sets the catalog name of the table described by this DbEntity.voidsetPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator) Set the primary key generator for this entity.voidsetQualifier(Expression qualifier) Sets qualifier for this entityvoidSets the database schema name of the table described by this DbEntity.translateToRelatedEntity(Expression expression, CayennePath relationshipPath) Transforms Expression rooted in this entity to an analogous expression rooted in related entity.Methods inherited from class org.apache.cayenne.map.EntityaddRelationship, clearRelationships, getAnyRelationship, getAttribute, getAttributeMap, getAttributes, getDataMap, getName, getParent, getRelationship, getRelationshipMap, getRelationships, lastPathComponent, removeRelationship, resolvePathComponents, resolvePathComponents, setDataMap, setName, setParent, toString, translateToRelatedEntity, updateAttribute
- 
Field Details- 
catalog
- 
schema
- 
- 
generatedAttributes- Since:
- 1.2
 
- 
primaryKeyGenerator
- 
qualifierQualifier, that will be applied to all select queries and joins with this DbEntity
 
- 
- 
Constructor Details- 
DbEntitypublic DbEntity()Creates an unnamed DbEntity.
- 
DbEntityCreates a named DbEntity.
 
- 
- 
Method Details- 
acceptVisitor- Specified by:
- acceptVisitorin interface- ConfigurationNode
- Since:
- 3.1
 
- 
encodeAsXMLPrints itself as XML to the provided XMLEncoder.- Specified by:
- encodeAsXMLin interface- XMLSerializable
- Since:
- 1.1
 
- 
getFullyQualifiedNameReturns table name including catalog and schema, if any of those are present.
- 
getSchemaReturns database schema of this table.- Returns:
- table's schema, null if not set.
 
- 
setSchemaSets the database schema name of the table described by this DbEntity.
- 
getCatalogReturns the catalog name of the table described by this DbEntity.
- 
setCatalogSets the catalog name of the table described by this DbEntity.
- 
getPrimaryKeysReturns an unmodifiable collection of DbAttributes representing the primary key of the table described by this DbEntity.- Since:
- 3.0
 
- 
getGeneratedAttributesReturns an unmodifiable collection of DbAttributes that are generated by the database.- Since:
- 1.2
 
- 
addAttributeAdds a new attribute to this entity.- Overrides:
- addAttributein class- Entity<DbEntity,- DbAttribute, - DbRelationship> 
- Throws:
- IllegalArgumentException- if Attribute has no name or there is an existing attribute with the same name
- IllegalArgumentException- if a relationship has the same name as this attribute
- Since:
- 3.0
 
- 
removeAttributeRemoves attribute from the entity, removes any relationship joins containing this attribute. Does nothing if the attribute name is not found.- Overrides:
- removeAttributein class- Entity<DbEntity,- DbAttribute, - DbRelationship> 
- See Also:
 
- 
clearAttributespublic void clearAttributes()- Overrides:
- clearAttributesin class- Entity<DbEntity,- DbAttribute, - DbRelationship> 
 
- 
resolvePathpublic Iterable<PathComponent<DbAttribute,DbRelationship>> resolvePath(Expression pathExp, Map<String, String> aliasMap) Returns an Iterable instance over expression path components based on this entity.- Specified by:
- resolvePathin class- Entity<DbEntity,- DbAttribute, - DbRelationship> 
- Since:
- 3.0
 
- 
resolvePathComponentspublic Iterator<CayenneMapEntry> resolvePathComponents(Expression pathExp) throws ExpressionException Description copied from class:EntityProcesses expressionpathExpand returns an Iterator of path components that contains a sequence of Attributes and Relationships. Note that if path is invalid and can not be resolved from this entity, this method will still return an Iterator, but an attempt to read the first invalid path component will result in ExpressionException.- Specified by:
- resolvePathComponentsin class- Entity<DbEntity,- DbAttribute, - DbRelationship> 
- Throws:
- ExpressionException
 
- 
setPrimaryKeyGeneratorSet the primary key generator for this entity. If null is passed, nothing is changed.
- 
getPrimaryKeyGeneratorReturn the primary key generator for this entity.
- 
dbEntityChangedDbEntity property changed event. May be name, attribute or relationship added or removed, etc. Attribute and relationship property changes are handled in respective listeners.- Specified by:
- dbEntityChangedin interface- DbEntityListener
- Since:
- 1.2
 
- 
dbEntityAddedNew entity has been created/added.- Specified by:
- dbEntityAddedin interface- DbEntityListener
 
- 
dbEntityRemovedEntity has been removed.- Specified by:
- dbEntityRemovedin interface- DbEntityListener
 
- 
dbAttributeAddedDescription copied from interface:DbAttributeListenerNew attribute has been created/added.- Specified by:
- dbAttributeAddedin interface- DbAttributeListener
 
- 
dbAttributeChangedDescription copied from interface:DbAttributeListenerAttribute property changed.- Specified by:
- dbAttributeChangedin interface- DbAttributeListener
 
- 
dbAttributeRemovedDescription copied from interface:DbAttributeListenerAttribute has been removed.- Specified by:
- dbAttributeRemovedin interface- DbAttributeListener
 
- 
dbRelationshipChangedRelationship property changed.- Specified by:
- dbRelationshipChangedin interface- DbRelationshipListener
 
- 
dbRelationshipAddedRelationship has been created/added.- Specified by:
- dbRelationshipAddedin interface- DbRelationshipListener
 
- 
dbRelationshipRemovedRelationship has been removed.- Specified by:
- dbRelationshipRemovedin interface- DbRelationshipListener
 
- 
getQualifier- Returns:
- qualifier that will be ANDed to all select queries with this entity
 
- 
setQualifierSets qualifier for this entity
- 
isFullReplacementIdAttachedReturns true if there is full replacement id is attached to an ObjectId. "Full" means that all PK columns are present and only PK columns are present.- Since:
- 1.2
 
- 
mappedObjEntities
- 
translateToRelatedEntityTransforms Expression rooted in this entity to an analogous expression rooted in related entity.- Specified by:
- translateToRelatedEntityin class- Entity<DbEntity,- DbAttribute, - DbRelationship> 
- Since:
- 5.0
 
 
-