public class DBRecordBean extends DBRecordBase
DBRecordBase.DBRecordRollbackHandler, DBRecordBase.State
Modifier and Type | Field and Description |
---|---|
protected boolean |
enableRollbackHandling |
protected DBRowSet |
rowset |
protected DBContext |
tempContext |
validateFieldValues
Constructor and Description |
---|
DBRecordBean()
Constructs a new DBRecordBean.
|
DBRecordBean(boolean enableRollbackHandling)
Constructs a new DBRecordBean.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the record by releasing all resources and resetting the record's state to invalid.
|
DBRecordBean |
create(DBContext context,
DBRowSet rowset)
Creates a new record
|
DBRecordBean |
create(DBContext context,
DBRowSet rowset,
Object[] initalKey)
Creates a new record
|
void |
delete(DBContext context)
This helper function calls the DBRowset.deleteRecord method
to delete the record.
|
DBContext |
getContext()
Returns the current Context
|
long |
getIdentity()
Returns the record identity for tables which have a single numeric primary key like AUTOINC
This method is provided for convenience in addition to the the getKey() method
|
DBRowSet |
getRowSet()
Returns the DBRowSet object.
|
boolean |
isRollbackHandlingEnabled()
Returns whether or not RollbackHandling is enabled for this record
|
static Object[] |
key(Object... values)
varArgs to Array
|
DBRecordBean |
read(DBContext context,
DBRowSet rowset,
DBCompareExpr whereConstraints)
Reads a record from the database
|
DBRecordBean |
read(DBContext context,
DBRowSet rowset,
long identity)
Reads a record from the database
|
DBRecordBean |
read(DBContext context,
DBRowSet rowset,
Object[] key)
Reads a record from the database
Hint: variable args param (Object...) caused problems with migration
|
DBRecordBean |
read(DBContext context,
DBRowSet rowset,
Object[] key,
DBRowSet.PartialMode mode,
DBColumn... columns)
Reads a record partially i.e. not with all but just some selected fields
There are two modes:
1.
|
DBRecordBean |
set(Column column,
Object value)
Overridden to change return type from DBCommandExpr to DBCommand
|
void |
setRollbackHandlingEnabled(boolean enabled)
Set whether or not RollbackHandling will be performed for this record
Since Rollback handling requires additional resources it should only be used if necessary
Especially for bulk operations it should be disabled
|
void |
update(DBContext context)
Updates the record in the database
|
addXmlData, addXmlMeta, allowFieldChange, assignParentIdentities, changeState, checkUpdateable, checkValid, checkValid, clone, createRollbackHandler, getColumn, getDatabase, getEntityType, getFieldCount, getFieldIndex, getFieldIndex, getFieldOptions, getFieldOptions, getFields, getKey, getKeyColumns, getState, getValue, getXmlDictionary, getXmlDocument, initData, isColumn, isExists, isFieldReadOnly, isFieldRequired, isFieldVisible, isModified, isNew, isReadOnly, isSame, isValid, isValidateFieldValues, isValueValid, modifyValue, onFieldChanged, onRecordChanged, setParentRecord, setRecordValue, setRecordValues, setRecordValues, setValidateFieldValues, setValue, setValue, updateComplete, validateAllValues, validateValue, wasAnyModified, wasModified, wasModified
formatValue, get, get, getArray, getBoolean, getBoolean, getDateTime, getDateTime, getDecimal, getDecimal, getDouble, getDouble, getEnum, getEnum, getEnum, getInt, getInt, getLocalDate, getLocalDate, getLocalDateTime, getLocalDateTime, getLong, getLong, getString, getString, getText, getValue, getValue, getValues, isNull, isNull, setBeanProperties, setBeanProperties, setBeanProperty
checkParamNull
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, isNull, isNull, setBeanProperties
protected transient DBContext tempContext
protected transient DBRowSet rowset
protected boolean enableRollbackHandling
public DBRecordBean(boolean enableRollbackHandling)
enableRollbackHandling
- flag whether to enable rollback handingpublic DBRecordBean()
context
- the DBContext for this recordrowset
- the corresponding RowSet(Table, View, Query, etc.)public DBContext getContext()
public DBRowSet getRowSet()
getRowSet
in class DBRecordBase
public boolean isRollbackHandlingEnabled()
isRollbackHandlingEnabled
in class DBRecordBase
public void setRollbackHandlingEnabled(boolean enabled)
enabled
- flag whether to enable or disable RollbackHandlingpublic long getIdentity()
NoPrimaryKeyException
- if the table has no primary keyNotSupportedException
- if the primary key is not a single column of if the column is not numericpublic void close()
DBRecordBase
close
in class DBRecordBase
public DBRecordBean create(DBContext context, DBRowSet rowset, Object[] initalKey)
public DBRecordBean create(DBContext context, DBRowSet rowset)
public DBRecordBean read(DBContext context, DBRowSet rowset, Object[] key)
key
- an array of the primary key valuespublic final DBRecordBean read(DBContext context, DBRowSet rowset, long identity)
identity
- the record id valuepublic DBRecordBean read(DBContext context, DBRowSet rowset, DBCompareExpr whereConstraints)
key
- an array of the primary key valuespublic DBRecordBean read(DBContext context, DBRowSet rowset, Object[] key, DBRowSet.PartialMode mode, DBColumn... columns)
key
- the primary key valuesmode
- flag whether to include only the given columns or whether to add all but the given columnscolumns
- the columns to include or exclude (depending on mode)public DBRecordBean set(Column column, Object value)
set
in interface Record
set
in class DBRecordBase
column
- a DBColumn objectvalue
- the valuepublic void update(DBContext context)
context
- the current contextpublic void delete(DBContext context)
context
- the current contextorg.apache.empire.db.DBTable#deleteRecord(Object[], Connection)
Copyright © 2008–2022 Apache Software Foundation. All rights reserved.