public class DbEntity extends Entity implements ConfigurationNode, DbEntityListener, DbAttributeListener, DbRelationshipListener
| Modifier and Type | Field and Description | 
|---|---|
| protected String | catalog | 
| protected Collection<DbAttribute> | generatedAttributes | 
| protected Collection<DbAttribute> | primaryKey | 
| protected DbKeyGenerator | primaryKeyGenerator | 
| protected Expression | qualifierQualifier, that will be applied to all select queries and joins with this
 DbEntity | 
| protected String | schema | 
attributes, dataMap, name, OUTER_JOIN_INDICATOR, PATH_SEPARATOR, relationships| Constructor and Description | 
|---|
| DbEntity()Creates an unnamed DbEntity. | 
| DbEntity(String name)Creates a named DbEntity. | 
| Modifier and Type | Method and Description | 
|---|---|
| <T> T | acceptVisitor(ConfigurationNodeVisitor<T> visitor) | 
| void | addAttribute(DbAttribute attr)Adds a new attribute to this entity. | 
| void | clearAttributes() | 
| void | dbAttributeAdded(AttributeEvent e)New attribute has been created/added. | 
| void | dbAttributeChanged(AttributeEvent e)Attribute property changed. | 
| void | dbAttributeRemoved(AttributeEvent e)Attribute has been removed. | 
| void | dbEntityAdded(EntityEvent e)New entity has been created/added. | 
| void | dbEntityChanged(EntityEvent e)DbEntity property changed event. | 
| void | dbEntityRemoved(EntityEvent e)Entity has been removed. | 
| void | dbRelationshipAdded(RelationshipEvent e)Relationship has been created/added. | 
| void | dbRelationshipChanged(RelationshipEvent e)Relationship property changed. | 
| void | dbRelationshipRemoved(RelationshipEvent e)Relationship has been removed. | 
| void | encodeAsXML(XMLEncoder encoder)Prints itself as XML to the provided XMLEncoder. | 
| DbAttribute | getAttribute(String attributeName)Returns attribute with name  attributeNameor null if no attribute
 with this name exists. | 
| Collection<DbAttribute> | getAttributes()Returns a Collection of all attributes that either belong to this
 DbEntity or inherited. | 
| String | getCatalog()Returns the catalog name of the table described by this DbEntity. | 
| String | getFullyQualifiedName()Returns table name including catalog and schema, if any of those are
 present. | 
| Collection<DbAttribute> | getGeneratedAttributes()Returns an unmodifiable collection of DbAttributes that are generated by
 the database. | 
| DbKeyGenerator | getPrimaryKeyGenerator()Return the primary key generator for this entity. | 
| Collection<DbAttribute> | getPrimaryKeys()Returns an unmodifiable collection of DbAttributes representing the
 primary key of the table described by this DbEntity. | 
| Expression | getQualifier() | 
| DbRelationship | getRelationship(String relName)Returns relationship with name  relName. | 
| SortedMap<String,DbRelationship> | getRelationshipMap()Returns an unmodifiable map of relationships sorted by name. | 
| Collection<DbRelationship> | getRelationships()Returns a Collection of relationships from this entity or inherited. | 
| String | getSchema()Returns database schema of this table. | 
| boolean | isFullReplacementIdAttached(ObjectId id)Returns true if there is full replacement id is attached to an ObjectId. | 
| PathComponent<DbAttribute,DbRelationship> | lastPathComponent(Expression path,
                 Map aliasMap)Convenience method returning the last component in the path iterator. | 
| Collection<ObjEntity> | mappedObjEntities() | 
| void | removeAttribute(String attrName)Removes attribute from the entity, removes any relationship joins
 containing this attribute. | 
| Iterable<PathComponent<DbAttribute,DbRelationship>> | resolvePath(Expression pathExp,
           Map aliasMap)Returns an Iterable instance over expression path components based on
 this entity. | 
| Iterator<CayenneMapEntry> | resolvePathComponents(Expression pathExp)Processes expression  pathExpand returns an Iterator of path
 components that contains a sequence of Attributes and Relationships. | 
| void | setCatalog(String catalog)Sets the catalog name of the table described by this DbEntity. | 
| void | setPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator)Set the primary key generator for this entity. | 
| void | setQualifier(Expression qualifier)Sets qualifier for this entity | 
| void | setSchema(String schema)Sets the database schema name of the table described by this DbEntity. | 
| Expression | translateToRelatedEntity(Expression expression,
                        String relationshipPath)Transforms Expression rooted in this entity to an analogous expression
 rooted in related entity. | 
addAttribute, addRelationship, clearRelationships, getAnyRelationship, getAttributeMap, getDataMap, getName, getParent, removeRelationship, resolvePathComponents, setDataMap, setName, setParent, toString, updateAttributeprotected String catalog
protected String schema
protected Collection<DbAttribute> primaryKey
protected Collection<DbAttribute> generatedAttributes
protected DbKeyGenerator primaryKeyGenerator
protected Expression qualifier
public DbEntity()
public DbEntity(String name)
public DbRelationship getRelationship(String relName)
EntityrelName. Will return null if no
 relationship with this name exists in the entity.getRelationship in class Entitypublic DbAttribute getAttribute(String attributeName)
EntityattributeName or null if no attribute
 with this name exists.getAttribute in class Entitypublic <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
acceptVisitor in interface ConfigurationNodepublic void encodeAsXML(XMLEncoder encoder)
encodeAsXML in interface XMLSerializablepublic String getFullyQualifiedName()
public String getSchema()
public void setSchema(String schema)
public String getCatalog()
public void setCatalog(String catalog)
public Collection<DbAttribute> getPrimaryKeys()
public Collection<DbAttribute> getAttributes()
getAttributes in class Entitypublic Collection<DbAttribute> getGeneratedAttributes()
public void addAttribute(DbAttribute attr)
IllegalArgumentException - if Attribute has no name or there is an existing attribute
                                  with the same nameIllegalArgumentException - if a relationship has the same name as this attributepublic void removeAttribute(String attrName)
removeAttribute in class EntityEntity.removeAttribute(String)public void clearAttributes()
clearAttributes in class Entitypublic Collection<DbRelationship> getRelationships()
getRelationships in class Entitypublic SortedMap<String,DbRelationship> getRelationshipMap()
EntitygetRelationshipMap in class Entitypublic PathComponent<DbAttribute,DbRelationship> lastPathComponent(Expression path, Map aliasMap)
EntitylastPathComponent in class Entitypublic Iterable<PathComponent<DbAttribute,DbRelationship>> resolvePath(Expression pathExp, Map aliasMap)
resolvePath in class Entitypublic Iterator<CayenneMapEntry> resolvePathComponents(Expression pathExp) throws ExpressionException
EntitypathExp and 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.resolvePathComponents in class EntityExpressionExceptionpublic void setPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator)
public DbKeyGenerator getPrimaryKeyGenerator()
public void dbEntityChanged(EntityEvent e)
dbEntityChanged in interface DbEntityListenerpublic void dbEntityAdded(EntityEvent e)
dbEntityAdded in interface DbEntityListenerpublic void dbEntityRemoved(EntityEvent e)
dbEntityRemoved in interface DbEntityListenerpublic void dbAttributeAdded(AttributeEvent e)
DbAttributeListenerdbAttributeAdded in interface DbAttributeListenerpublic void dbAttributeChanged(AttributeEvent e)
DbAttributeListenerdbAttributeChanged in interface DbAttributeListenerpublic void dbAttributeRemoved(AttributeEvent e)
DbAttributeListenerdbAttributeRemoved in interface DbAttributeListenerpublic void dbRelationshipChanged(RelationshipEvent e)
dbRelationshipChanged in interface DbRelationshipListenerpublic void dbRelationshipAdded(RelationshipEvent e)
dbRelationshipAdded in interface DbRelationshipListenerpublic void dbRelationshipRemoved(RelationshipEvent e)
dbRelationshipRemoved in interface DbRelationshipListenerpublic Expression getQualifier()
public void setQualifier(Expression qualifier)
public boolean isFullReplacementIdAttached(ObjectId id)
public Collection<ObjEntity> mappedObjEntities()
public Expression translateToRelatedEntity(Expression expression, String relationshipPath)
translateToRelatedEntity in class EntityCopyright © 2001–2023 Apache Cayenne. All rights reserved.