I need to do run a sql query before and after the
dsResponse.execute() in the DMIInterceptor, but in the same transaction.
I did the same like in the showcase example but isn't transactional.
Is this possible and should it work like this?
Code is like:
dsRequest.setPartOfTransaction(true);
SQLTransaction.startTransaction(dsRequest.rpc);
Connection connection = SQLTransaction.getConnection(dsRequest.rpc);
// FIRST ONE:
Connection conn = connection;
try {
PreparedStatement stmt = conn.prepareStatement(createNewCstmSttngSQL);
stmt.setString(3, masterId);
...
stmt.execute();
stmt.close();
dsResponse.setStatus(DSResponse.STATUS_SUCCESS);
\} catch( Exception e){
dsResponse.setStatus(DSResponse.STATUS_FAILTURE);
}
// SECOND ONE:
dsRequest.execute();
// Third one like first one:
Connection conn = connection;
try {
PreparedStatement stmt = conn.prepareStatement(createNewCstmSttngSQL);
stmt.setString(3, masterId);
...
stmt.execute();
stmt.close();
dsResponse.setStatus(DSResponse.STATUS_SUCCESS);
\} catch( Exception e){
dsResponse.setStatus(DSResponse.STATUS_FAILTURE);
}
SQLTransaction.endTransaction(dsRequest.rpc);
connection.close();
dsResponse.execute() in the DMIInterceptor, but in the same transaction.
I did the same like in the showcase example but isn't transactional.
Is this possible and should it work like this?
Code is like:
dsRequest.setPartOfTransaction(true);
SQLTransaction.startTransaction(dsRequest.rpc);
Connection connection = SQLTransaction.getConnection(dsRequest.rpc);
// FIRST ONE:
Connection conn = connection;
try {
PreparedStatement stmt = conn.prepareStatement(createNewCstmSttngSQL);
stmt.setString(3, masterId);
...
stmt.execute();
stmt.close();
dsResponse.setStatus(DSResponse.STATUS_SUCCESS);
\} catch( Exception e){
dsResponse.setStatus(DSResponse.STATUS_FAILTURE);
}
// SECOND ONE:
dsRequest.execute();
// Third one like first one:
Connection conn = connection;
try {
PreparedStatement stmt = conn.prepareStatement(createNewCstmSttngSQL);
stmt.setString(3, masterId);
...
stmt.execute();
stmt.close();
dsResponse.setStatus(DSResponse.STATUS_SUCCESS);
\} catch( Exception e){
dsResponse.setStatus(DSResponse.STATUS_FAILTURE);
}
SQLTransaction.endTransaction(dsRequest.rpc);
connection.close();
Comment