JDBC 4.0 RowId Interface
The lifetime of a RowId object may be valid as long as the row is not deleted and the lifetime of the RowId is within the bounds of the lifetime of the RowId's data source. The DatabaseMetaDataMethod.getRowIdLifetime() can be used to determine the lifetime validity of the RowId object. The return value from this method is a RowIdLifetime enumerated data-type. Possible values are:
- ROWID_UNSUPPORTED - backend does not support RowIds
- ROWID_VALID_OTHER - lifetime of the RowId is implementation dependant
- ROWID_VALID_TRANSACTION - lifetime of the RowId is within the transaction as long as the row is not deleted
- ROWID_VALID_SESSION - the lifetime of the RowId is as long as the session as long as the row is not deleted
- ROWID_VALID_FOREVER - the lifetime of the RowId is unlimited as long as the row is not deleted
You can obtain a ROWID using the ResultSet.getRowId() method and may use the PreparedStatement.setRowId() to use a RowId in query.
A RowId object value is typically not portable between data sources and should be considered as specific to the data source when using the set or update method in PreparedStatement and ResultSet objects respectively. It is therefore inadvisable to get a RowId from a ResultSet object with a connection ’Foo’ and then attempt to use the RowId in a unrelated ResultSet object with a connection ’Bar’.
- Login or register to post comments
- Printer-friendly version
- lancea's blog
- 1100 reads





