I have tow method as following:
@org.springframework.transaction.annotation.Transactional
public boolean creditAccount(String accountId)
{
LogUtility.logTxn(accountId);
// Do somethings
}
public class LogUtility
{
javax.sql.DataSource dataSource; // this property initialized in static block of intilalizing LogUtility class
public logTxn(String account)
{
java.sql.Connection conn = dataSource.getConnection();
conn.setAutoCommit(true);
CallableStatement cs = conn.prepareCall(/*name of a oracle package and its procedures*/);
cStmt.execute();
}
}
I want understand when happen a exception in creditAccount
method after LogUtility.logTxn
method called (here : // Do somethings
) then LogUtility.logTxn
method commit or rollback?
I know creditAccount
method in this situation rollbacked but I don't know behavior of logTxn
method.
You create a another connection from data source , means you have a another session with data base, so this connection has its transaction and commit /rollback solitary