use of org.apache.cayenne.CayenneException in project cayenne by apache.
the class UtilTest method testUnwindException3.
@Test
public void testUnwindException3() throws Exception {
Throwable root = new Throwable();
CayenneException e = new CayenneException(root);
assertSame(root, Util.unwindException(e));
}
use of org.apache.cayenne.CayenneException in project cayenne by apache.
the class UtilTest method testUnwindException2.
@Test
public void testUnwindException2() throws Exception {
CayenneException e = new CayenneException();
assertSame(e, Util.unwindException(e));
}
use of org.apache.cayenne.CayenneException in project cayenne by apache.
the class Oracle8LOBBatchAction method performAction.
@Override
public void performAction(Connection connection, OperationObserver observer) throws SQLException, Exception {
Oracle8LOBBatchTranslator translator;
if (query instanceof InsertBatchQuery) {
translator = new Oracle8LOBInsertBatchTranslator((InsertBatchQuery) query, adapter, OracleAdapter.TRIM_FUNCTION);
} else if (query instanceof UpdateBatchQuery) {
translator = new Oracle8LOBUpdateBatchTranslator((UpdateBatchQuery) query, adapter, OracleAdapter.TRIM_FUNCTION);
} else {
throw new CayenneException("Unsupported batch type for special LOB processing: " + query);
}
translator.setNewBlobFunction(OracleAdapter.NEW_BLOB_FUNCTION);
translator.setNewClobFunction(OracleAdapter.NEW_CLOB_FUNCTION);
// no batching is done, queries are translated
// for each batch set, since prepared statements
// may be different depending on whether LOBs are NULL or not..
Oracle8LOBBatchQueryWrapper selectQuery = new Oracle8LOBBatchQueryWrapper(query);
List<DbAttribute> qualifierAttributes = selectQuery.getDbAttributesForLOBSelectQualifier();
for (BatchQueryRow row : query.getRows()) {
selectQuery.indexLOBAttributes(row);
int updated;
String updateStr = translator.createSql(row);
// 1. run row update
logger.log(updateStr);
try (PreparedStatement statement = connection.prepareStatement(updateStr)) {
DbAttributeBinding[] bindings = translator.updateBindings(row);
logger.logQueryParameters("bind", bindings);
bind(adapter, statement, bindings);
updated = statement.executeUpdate();
logger.logUpdateCount(updated);
}
// 2. run row LOB update (SELECT...FOR UPDATE and writing out LOBs)
processLOBRow(connection, translator, selectQuery, qualifierAttributes, row);
// finally, notify delegate that the row was updated
observer.nextCount(query, updated);
}
}
Aggregations