public class DBRecord extends DBRecordBase
DBRecordBase.DBRecordRollbackHandler, DBRecordBase.State| Modifier and Type | Field and Description |
|---|---|
protected DBContext |
context |
protected DBRowSet |
rowset |
validateFieldValues| Modifier | Constructor and Description |
|---|---|
|
DBRecord(DBContext context,
DBRowSet rowset)
Constructs a new DBRecord.
|
protected |
DBRecord(DBContext context,
DBRowSet rowset,
boolean enableRollbackHandling)
Internal constructor for DBRecord
May be used by derived classes to provide special behaviour
|
| Modifier and Type | Method and Description |
|---|---|
DBRecord |
create()
Creates a new record
|
DBRecord |
create(Object[] initalKey)
Creates a new record
|
void |
delete()
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
|
DBRecord |
read(DBCompareExpr whereConstraints)
Reads a record from the database
|
DBRecord |
read(long identity)
Reads a record from the database
|
DBRecord |
read(Object[] key)
Reads a record from the database
Hint: variable args param (Object...) caused problems with migration
|
DBRecord |
read(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.
|
protected DBContext |
readContext(ObjectInputStream strm) |
protected DBRowSet |
readRowSet(ObjectInputStream strm) |
DBRecord |
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()
Updates the record and saves all changes in the database.
|
protected void |
writeContext(ObjectOutputStream strm) |
protected void |
writeRowSet(ObjectOutputStream strm) |
addXmlData, addXmlMeta, allowFieldChange, assignParentIdentities, changeState, checkUpdateable, checkValid, checkValid, clone, close, 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, wasModifiedformatValue, 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, setBeanPropertycheckParamNullequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, isNull, isNull, setBeanPropertiesprotected final transient DBContext context
protected final transient DBRowSet rowset
protected DBRecord(DBContext context, DBRowSet rowset, boolean enableRollbackHandling)
public static Object[] key(Object... values)
values - protected void writeContext(ObjectOutputStream strm) throws IOException
IOExceptionprotected void writeRowSet(ObjectOutputStream strm) throws IOException
IOExceptionprotected DBContext readContext(ObjectInputStream strm) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionprotected DBRowSet readRowSet(ObjectInputStream strm) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic DBContext getContext()
public DBRowSet getRowSet()
getRowSet in class DBRecordBasepublic boolean isRollbackHandlingEnabled()
isRollbackHandlingEnabled in class DBRecordBasepublic 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 DBRecord create()
public DBRecord read(Object[] key)
key - an array of the primary key valuespublic final DBRecord read(long identity)
identity - the record id valuepublic DBRecord read(DBCompareExpr whereConstraints)
key - an array of the primary key valuespublic DBRecord read(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 DBRecord set(Column column, Object value)
set in interface Recordset in class DBRecordBasecolumn - a DBColumn objectvalue - the valuepublic void update()
public void delete()
conn - a valid connection to the database.org.apache.empire.db.DBTable#deleteRecord(Object[], Connection)Copyright © 2008–2022 Apache Software Foundation. All rights reserved.