* the transaction.
*/
public void doTag(XMLOutput output) throws Exception {
if ((rawDataSource == null) && dataSourceSpecified) {
throw new JellyException(Resources.getMessage("SQL_DATASOURCE_NULL"));
}
DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource, context);
try {
conn = dataSource.getConnection();
origIsolation = conn.getTransactionIsolation();
if (origIsolation == Connection.TRANSACTION_NONE) {
throw new JellyException(Resources.getMessage("TRANSACTION_NO_SUPPORT"));
}
if ((isolation != Connection.TRANSACTION_NONE)
&& (isolation != origIsolation)) {
conn.setTransactionIsolation(isolation);
}
conn.setAutoCommit(false);
}
catch (SQLException e) {
throw new JellyException(
Resources.getMessage("ERROR_GET_CONNECTION", e.getMessage()));
}
boolean finished = false;
try {
invokeBody(output);
finished = true;
}
catch (Exception e) {
if (conn != null) {
try {
conn.rollback();
}
catch (SQLException s) {
// Ignore to not hide orignal exception
}
doFinally();
}
throw e;
}
// lets commit
try {
conn.commit();
}
catch (SQLException e) {
throw new JellyException(
Resources.getMessage("TRANSACTION_COMMIT_ERROR", e.getMessage()));
}
finally {
doFinally();
}