DatastoreMapping mapping,
byte[] bytes)
{
// Generate "SELECT {blobColumn} FROM TABLE WHERE ID=? FOR UPDATE" statement
FetchStatement fetchStmt = new RDBMSFetchStatement(datastoreContainer);
fetchStmt.select(mapping.getDatastoreField());
JavaTypeMapping idMapping = datastoreContainer.getIDMapping();
for (int i = 0; i < idMapping.getNumberOfDatastoreFields(); i++)
{
fetchStmt.andCondition(fetchStmt.referenceDatastoreField(idMapping.getDataStoreMapping(i).getDatastoreField()) + " = ?");
}