| java.lang.Object biz.hammurapi.sql.DatabaseObject
All known Subclasses: biz.hammurapi.sql.MeasuringDatabaseObject,
DatabaseObject | public class DatabaseObject implements DomSerializable,ColumnChangeListener,Cloneable,ContextConfigurable,Context,DomConfigurable,Attributable,Versioned,Observable,IDatabaseObject,Serializable(Code) | | SQLC-generated interface implementations implement this method to achieve
differential update functionality - inserting and updating only modified fields.
author: Pavel Vlasov version: $Revision: 1.11 $ |
Constructor Summary | |
public | DatabaseObject() | public | DatabaseObject(boolean force) Parameters: force - Forces columns to be marked as modified if setter method is invoked even if value being set equals to existing columnvalue. |
Method Summary | |
protected void | addColumn(Column column) | public void | addObserver(Observer observer) | protected RelationshipList | addRelationship(String name, String itemName, Relationship relationship) Parameters: name - Name for composite relationships to render in XML, null for shared relationships. Parameters: itemName - name of item element in XML. Parameters: itemClass - item class. | public void | clear() | public Object | clone() Clones object, clears columns collection, clears isDeleted and isModified flags. | public void | configure(Context context, CompositeConverter converter) | public void | configure(Node configNode, Context context) | public void | copy(DatabaseObject source) | public int | delete(SQLProcessor processor, String tableName) | public boolean | equals(Object otherBean) Two objects are considered equal and all their fields are equal. | public void | fromDom(Element holder) | public void | fromDom(Element holder, Properties nameMap) | public Object | get(String name) | public Object | getAttribute(Object key) | protected Column | getColumn(String name) | public Object | getColumnAttribute(String columnName, Object key) | public int | getObjectVersion() | protected RelationshipList | getRelationship(String name) | protected int | getSqlType(String columnName, int generatedType) Allows to override generated column types with <class name>.sqltypes resource. | public int | hashCode() | public int | insert(SQLProcessor processor, String tableName) | public boolean | isDeleted() | public boolean | isModified() | protected void | loadRelationships(SQLProcessor processor) Use this method to eagerly load relationships in constructors. | public void | onChange(Column column) Sets modified flag to true and increments version number.
Also broadcasts the change to observers. | public Object | removeAttribute(Object key) | public Object | removeColumnAttribute(String columnName, Object key) | public void | removeObserver(Observer observer) | public void | setAttribute(Object key, Object value) | public void | setColumnAttribute(String columnName, Object key, Object value) | public void | setOriginal() | public void | toDom(Element holder) | public void | toDom(Element holder, Properties nameMap, boolean originals) | public String | toString() | public int | update(SQLProcessor processor, String tableName) |
objectVersion | protected int objectVersion(Code) | | Subclasses can choose to read object version from the database.
|
originalVersion | protected int originalVersion(Code) | | |
DatabaseObject | public DatabaseObject()(Code) | | Default constructor
|
DatabaseObject | public DatabaseObject(boolean force)(Code) | | Parameters: force - Forces columns to be marked as modified if setter method is invoked even if value being set equals to existing columnvalue. Useful during inserts with non-nullable columns which map to primitive types and as such have default values. |
addRelationship | protected RelationshipList addRelationship(String name, String itemName, Relationship relationship)(Code) | | Parameters: name - Name for composite relationships to render in XML, null for shared relationships. Parameters: itemName - name of item element in XML. Parameters: itemClass - item class. This class shall have constructor from Element,boolean in order to load from XML docs. Parameters: relationship - |
clear | public void clear()(Code) | | |
equals | public boolean equals(Object otherBean)(Code) | | Two objects are considered equal and all their fields are equal.
Parameters: otherBean - Other object true if object classes are equal and all member column values areequal. |
getObjectVersion | public int getObjectVersion()(Code) | | |
getSqlType | protected int getSqlType(String columnName, int generatedType)(Code) | | Allows to override generated column types with <class name>.sqltypes resource.
Subclasses shall use this method when dealing with Object columns.
Parameters: columnName - Parameters: generatedType - |
hashCode | public int hashCode()(Code) | | |
isDeleted | public boolean isDeleted()(Code) | | |
isModified | public boolean isModified()(Code) | | |
onChange | public void onChange(Column column)(Code) | | Sets modified flag to true and increments version number.
Also broadcasts the change to observers. Changed column is
passed as second argument of update() method.
Override this method in subclasses to react on
change events, but don't forget to invoke
super.onChange().
Parameters: column - Changed column |
setOriginal | public void setOriginal()(Code) | | |
|
|