Here you can find the source of rollbackTransaction(final Connection conn, final SQLException e)
Parameter | Description |
---|---|
conn | connessione al db |
e | eccezione lanciata |
Parameter | Description |
---|---|
SQLException | if a database access error occurs |
public static void rollbackTransaction(final Connection conn, final SQLException e) throws SQLException
//package com.java2s; //License from project: Open Source License import java.io.PrintWriter; import java.io.StringWriter; import java.sql.Connection; import java.sql.SQLException; import org.apache.log4j.Logger; public class Main { /** logger. */ private static Logger logger; /**//from w w w. j ava 2 s. c o m * Esegue un rollback della transazione. * @param conn * connessione al db * @param e * eccezione lanciata * @throws SQLException * if a database access error occurs */ public static void rollbackTransaction(final Connection conn, final SQLException e) throws SQLException { if (conn != null) { conn.rollback(); logger.fatal("Connection rollback..."); logger.fatal(e.getStackTrace()); StringWriter sWriter = new StringWriter(); e.printStackTrace(new PrintWriter(sWriter)); logger.fatal(sWriter.getBuffer().toString()); } } }