Package org.apache.openjpa.jdbc.sql
Class RowImpl
java.lang.Object
org.apache.openjpa.jdbc.sql.RowImpl
- Direct Known Subclasses:
PrimaryRow
,SecondaryRow
,StateComparisonVersionStrategy.CustomUpdate
Basic
Row
implementation.- Author:
- Abe White
-
Field Summary
Modifier and TypeFieldDescriptionprotected byte
static final Object
static final int
protected static final int
Fields inherited from interface org.apache.openjpa.jdbc.sql.Row
ACTION_DELETE, ACTION_INSERT, ACTION_UNKNOWN, ACTION_UPDATE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Return true if the given column index is settable.protected boolean
Return true if any of the given column indexes are settable.void
Clear a circular foreign key.void
clearRelationId
(Column col) Clear a circular relation id.clone()
Performs a proper deep clone.void
Copy all values from this row into the given one.void
flush
(PreparedStatement stmnt, int idx, DBDictionary dict, JDBCStore store) Flush the row's values to the given prepared statement.void
flush
(PreparedStatement stmnt, DBDictionary dict, JDBCStore store) Flush the row's values to the given prepared statement.protected String
generateSQL
(DBDictionary dict) Generate the SQL for this row; the result of this method is cached.int
Return the action for this row.Column[]
This implementation does not track failed objects.int
The number of parameters that will be set for this row.This implementation does not track primary keys.Return the value set for update on the given column.getSQL
(DBDictionary dict) Return the SQL for the operation on this row.getTable()
Return the table for this row.int[]
getTypes()
Object[]
getVals()
Return the value set for where on the given column.boolean
Secondary rows cannot be dependent.boolean
boolean
isValid()
Whether this row has information set on it.protected RowImpl
newInstance
(Column[] cols, int action) Return a new row.void
Set the value of the given column in this row.void
setAsciiStream
(Column col, InputStream val, int length) Set the value of the given column in this row.void
setBigDecimal
(Column col, BigDecimal val) Set the value of the given column in this row.void
setBigInteger
(Column col, BigInteger val) Set the value of the given column in this row.void
setBinaryStream
(Column col, InputStream val, int length) Set the value of the given column in this row.void
Set the value of the given column in this row.void
setBoolean
(Column col, boolean val) Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
setCalendar
(Column col, Calendar val) Set the value of the given column in this row.void
Set the value of the given column in this row.void
setCharacterStream
(Column col, Reader val, int length) Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
setFailedObject
(Object failed) This implementation does not track failed objects.void
Set the value of the given column in this row.void
setFlushed
(boolean isFlushed) void
setForeignKey
(ForeignKey fk, ColumnIO io, OpenJPAStateManager sm) Set the value of the given foreign key to the given object.void
Set the value of the given foreign key to the given object.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.protected void
All set column methods delegate to this one.void
setPrimaryKey
(ColumnIO io, OpenJPAStateManager sm) Set the primary key to represent the given object.void
Set the primary key to represent the given object.void
Set a DB understood value for the given column.void
setRelationId
(Column col, OpenJPAStateManager sm, RelationId rel) Set the value of the given column to the identity of given instance, using the given callback to create the column value.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
Set the value of the given column in this row.void
setTimestamp
(Column col, Timestamp val, Calendar cal) Set the value of the given column in this row.void
setValid
(boolean valid) Whether this row has information set on it.void
whereArray
(Column col, Array val) Set an equality condition on the value of the given column in this row.void
whereAsciiStream
(Column col, InputStream val, int length) Set an equality condition on the value of the given column in this row.void
whereBigDecimal
(Column col, BigDecimal val) Set an equality condition on the value of the given column in this row.void
whereBigInteger
(Column col, BigInteger val) Set an equality condition on the value of the given column in this row.void
whereBinaryStream
(Column col, InputStream val, int length) Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
whereBoolean
(Column col, boolean val) Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
whereBytes
(Column col, byte[] val) Set an equality condition on the value of the given column in this row.void
whereCalendar
(Column col, Calendar val) Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
whereCharacterStream
(Column col, Reader val, int length) Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
whereDouble
(Column col, double val) Set an equality condition on the value of the given column in this row.void
whereFloat
(Column col, float val) Set an equality condition on the value of the given column in this row.void
Set the foreign key equality criteria to link to the given object.void
Set an equality condition on the value of the given column in this row.void
whereLocale
(Column col, Locale val) Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
whereNumber
(Column col, Number val) Set an equality condition on the value of the given column in this row.void
whereObject
(Column col, Object val) Set an equality condition on the value of the given column in this row.protected void
whereObject
(Column col, Object val, int metaType) All where column methods delegate to this one.void
Set the primary key equality criteria for this row.void
Set a DB understood where condition for the given column.void
whereShort
(Column col, short val) Set an equality condition on the value of the given column in this row.void
whereString
(Column col, String val) Set an equality condition on the value of the given column in this row.void
Set an equality condition on the value of the given column in this row.void
whereTimestamp
(Column col, Timestamp val, Calendar cal) Set an equality condition on the value of the given column in this row.
-
Field Details
-
NULL
-
VALID
protected static final int VALID- See Also:
-
RAW
public static final int RAW- See Also:
-
flags
protected byte flags
-
-
Constructor Details
-
RowImpl
Constructor.- Parameters:
table
- the table the row is a part ofaction
- the action on the row
-
RowImpl
-
-
Method Details
-
getTable
Description copied from interface:Row
Return the table for this row. -
getColumns
-
getAction
public int getAction()Description copied from interface:Row
Return the action for this row. -
isValid
public boolean isValid()Description copied from interface:Row
Whether this row has information set on it. -
setValid
public void setValid(boolean valid) Description copied from interface:Row
Whether this row has information set on it. -
getPrimaryKey
This implementation does not track primary keys.- Specified by:
getPrimaryKey
in interfaceRow
-
getFailedObject
This implementation does not track failed objects.- Specified by:
getFailedObject
in interfaceRow
-
setFailedObject
This implementation does not track failed objects.- Specified by:
setFailedObject
in interfaceRow
-
isDependent
public boolean isDependent()Secondary rows cannot be dependent. -
getSet
Return the value set for update on the given column. -
getWhere
Return the value set for where on the given column. -
setPrimaryKey
Description copied from interface:Row
Set the primary key to represent the given object.- Specified by:
setPrimaryKey
in interfaceRow
- Throws:
SQLException
-
setPrimaryKey
Description copied from interface:Row
Set the primary key to represent the given object.- Specified by:
setPrimaryKey
in interfaceRow
- Parameters:
io
- information on which columns are settable; may be null- Throws:
SQLException
-
wherePrimaryKey
Description copied from interface:Row
Set the primary key equality criteria for this row.- Specified by:
wherePrimaryKey
in interfaceRow
- Throws:
SQLException
-
setForeignKey
Description copied from interface:Row
Set the value of the given foreign key to the given object. If the related type uses table-per-class mappings, the foreign key may be targeted at an independent superclass table.- Specified by:
setForeignKey
in interfaceRow
- Throws:
SQLException
-
setForeignKey
Description copied from interface:Row
Set the value of the given foreign key to the given object. If the related type uses table-per-class mappings, the foreign key may be targeted at an independent superclass table.- Specified by:
setForeignKey
in interfaceRow
io
- information on which columns are settable; may be null- Throws:
SQLException
-
whereForeignKey
Description copied from interface:Row
Set the foreign key equality criteria to link to the given object. If the related type uses table-per-class mappings, the foreign key may be targeted at an independent superclass table.- Specified by:
whereForeignKey
in interfaceRow
- Throws:
SQLException
-
clearForeignKey
Clear a circular foreign key.- Throws:
SQLException
-
canSetAny
Return true if any of the given column indexes are settable. -
canSet
Return true if the given column index is settable. -
setRelationId
Description copied from interface:Row
Set the value of the given column to the identity of given instance, using the given callback to create the column value. This method is used for mappings that store some serialized form of id values, but must make sure that the related object's id is assigned (which might require an insert if the instance uses auto-increment) before it is serialized.- Specified by:
setRelationId
in interfaceRow
- Throws:
SQLException
-
clearRelationId
Clear a circular relation id.- Throws:
SQLException
-
setArray
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setArray
in interfaceRow
- Throws:
SQLException
-
setAsciiStream
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setAsciiStream
in interfaceRow
- Throws:
SQLException
-
setBigDecimal
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setBigDecimal
in interfaceRow
- Throws:
SQLException
-
setBigInteger
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setBigInteger
in interfaceRow
- Throws:
SQLException
-
setBinaryStream
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setBinaryStream
in interfaceRow
- Throws:
SQLException
-
setBlob
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setBlob
in interfaceRow
- Throws:
SQLException
-
setBoolean
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setBoolean
in interfaceRow
- Throws:
SQLException
-
setByte
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setByte
in interfaceRow
- Throws:
SQLException
-
setBytes
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setBytes
in interfaceRow
- Throws:
SQLException
-
setCalendar
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setCalendar
in interfaceRow
- Throws:
SQLException
-
setChar
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setChar
in interfaceRow
- Throws:
SQLException
-
setCharacterStream
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setCharacterStream
in interfaceRow
- Throws:
SQLException
-
setClob
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setClob
in interfaceRow
- Throws:
SQLException
-
setDate
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setDate
in interfaceRow
- Throws:
SQLException
-
setDate
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setDate
in interfaceRow
- Throws:
SQLException
-
setDouble
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setDouble
in interfaceRow
- Throws:
SQLException
-
setFloat
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setFloat
in interfaceRow
- Throws:
SQLException
-
setInt
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setInt
in interfaceRow
- Throws:
SQLException
-
setLong
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setLong
in interfaceRow
- Throws:
SQLException
-
setLocale
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setLocale
in interfaceRow
- Throws:
SQLException
-
setNull
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setNull
in interfaceRow
- Throws:
SQLException
-
setNull
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setNull
in interfaceRow
overrideDefault
- whether to set this column to null even if this is an insert and the column has a default- Throws:
SQLException
-
setNumber
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setNumber
in interfaceRow
- Throws:
SQLException
-
setRaw
Description copied from interface:Row
Set a DB understood value for the given column. The value will not be parameterized and instead be inserted as raw SQL.- Specified by:
setRaw
in interfaceRow
- Throws:
SQLException
-
setShort
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setShort
in interfaceRow
- Throws:
SQLException
-
setString
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setString
in interfaceRow
- Throws:
SQLException
-
setTime
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setTime
in interfaceRow
- Throws:
SQLException
-
setTimestamp
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setTimestamp
in interfaceRow
- Throws:
SQLException
-
setObject
Description copied from interface:Row
Set the value of the given column in this row.- Specified by:
setObject
in interfaceRow
- Parameters:
col
- the column being setval
- the value for the column- Throws:
SQLException
-
whereArray
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereArray
in interfaceRow
- Throws:
SQLException
-
whereAsciiStream
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereAsciiStream
in interfaceRow
- Throws:
SQLException
-
whereBigDecimal
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereBigDecimal
in interfaceRow
- Throws:
SQLException
-
whereBigInteger
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereBigInteger
in interfaceRow
- Throws:
SQLException
-
whereBinaryStream
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereBinaryStream
in interfaceRow
- Throws:
SQLException
-
whereBlob
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereBlob
in interfaceRow
- Throws:
SQLException
-
whereBoolean
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereBoolean
in interfaceRow
- Throws:
SQLException
-
whereByte
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereByte
in interfaceRow
- Throws:
SQLException
-
whereBytes
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereBytes
in interfaceRow
- Throws:
SQLException
-
whereCalendar
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereCalendar
in interfaceRow
- Throws:
SQLException
-
whereChar
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereChar
in interfaceRow
- Throws:
SQLException
-
whereCharacterStream
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereCharacterStream
in interfaceRow
- Throws:
SQLException
-
whereClob
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereClob
in interfaceRow
- Throws:
SQLException
-
whereDate
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereDate
in interfaceRow
- Throws:
SQLException
-
whereDate
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereDate
in interfaceRow
- Throws:
SQLException
-
whereDouble
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereDouble
in interfaceRow
- Throws:
SQLException
-
whereFloat
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereFloat
in interfaceRow
- Throws:
SQLException
-
whereInt
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereInt
in interfaceRow
- Throws:
SQLException
-
whereLong
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereLong
in interfaceRow
- Throws:
SQLException
-
whereLocale
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereLocale
in interfaceRow
- Throws:
SQLException
-
whereNull
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereNull
in interfaceRow
- Throws:
SQLException
-
whereNumber
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereNumber
in interfaceRow
- Throws:
SQLException
-
whereRaw
Description copied from interface:Row
Set a DB understood where condition for the given column. The value will not be parameterized and instead be inserted as raw SQL.- Specified by:
whereRaw
in interfaceRow
- Throws:
SQLException
-
whereShort
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereShort
in interfaceRow
- Throws:
SQLException
-
whereString
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereString
in interfaceRow
- Throws:
SQLException
-
whereTime
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereTime
in interfaceRow
- Throws:
SQLException
-
whereTimestamp
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereTimestamp
in interfaceRow
- Throws:
SQLException
-
whereObject
Description copied from interface:Row
Set an equality condition on the value of the given column in this row.- Specified by:
whereObject
in interfaceRow
- Parameters:
col
- the column being setval
- the value for the column- Throws:
SQLException
-
setObject
protected void setObject(Column col, Object val, int metaType, boolean overrideDefault) throws SQLException All set column methods delegate to this one. Set the given object unless this is an insert and the given column is auto-assigned.- Throws:
SQLException
-
whereObject
All where column methods delegate to this one.- Throws:
SQLException
-
getSQL
Return the SQL for the operation on this row. -
generateSQL
Generate the SQL for this row; the result of this method is cached. -
getParameterCount
public int getParameterCount()The number of parameters that will be set for this row. -
flush
Flush the row's values to the given prepared statement.- Throws:
SQLException
-
flush
public void flush(PreparedStatement stmnt, int idx, DBDictionary dict, JDBCStore store) throws SQLException Flush the row's values to the given prepared statement.- Throws:
SQLException
-
clone
Performs a proper deep clone. -
newInstance
Return a new row. -
copyInto
Copy all values from this row into the given one.- Parameters:
whereOnly
- if true, only copy where conditions
-
getVals
-
getTypes
public int[] getTypes() -
isFlushed
public boolean isFlushed() -
setFlushed
public void setFlushed(boolean isFlushed)
-