Hi, Jeanne. My onMessage() invoke the next method:
public void insert( InfoOperacion operacion) throws AuditoriaException
{
Connection connection = null;
PreparedStatement statement = null;
ResultSet rs = null;
String sql="INSERT INTO COMPONENTE_AUDITORIA ( COMPONENTE_AUDITORIA_ID_OP"+
",COMPONENTE_AUDITORIA_USUARIO,COMPONENTE_AUDITORIA_US_BD"+
",COMPONENTE_AUDITORIA_F_HORA,COMPONENTE_AUDITORIA_ACCION"+
",COMPONENTE_AUDITORIA_OBJETO," +
"COMPONENTE_AUDITORIA_ANTES,COMPONENTE_AUDITORIA_DESPUES" +
",COMPONENTE_AUDITORIA_OID, COMPONENTE_AUDITORIA_IP) " +
"values (?,?,?,?,?,?,?,?,?,?)";
try
{
connection = DBLocator.getConnection ();
//Buscar ultimo id
statement = connection.prepareStatement("SELECT MAX(COMPONENTE_AUDITORIA_ID_OP) FROM COMPONENTE_AUDITORIA");
rs = statement.executeQuery();
if(rs.next()) {
operacion.setIdOperacion(rs.getInt(1)+1);
} else {
operacion.setIdOperacion(1);
}
rs.close();
statement.close();
statement = connection.prepareStatement ( sql );
statement.setInt(1, operacion.getIdOperacion());
statement.setString(2,operacion.getUsuario());
statement.setString(3,operacion.getUsuarioBD());
statement.setString(4,operacion.getFechaHora());
statement.setString(5,operacion.getAccion());
statement.setString(6,operacion.getObjeto());
statement.setString(7,operacion.getAntes().toString());
statement.setString(8,operacion.getDespues().toString());
statement.setString(9,operacion.getOid());
statement.setString(10,operacion.getIp());
statement.executeUpdate ( );
}
catch(Exception e)
{
throw new AuditoriaException(e.getMessage(),e);
}
finally
{
DBLocator.closeDBObject(rs);
DBLocator.closeDBObject(statement);
DBLocator.closeDBObject(connection);
}
}
Do you have any suggestion for this problem??, thanks
[ September 21, 2008: Message edited by: Carlos Andres Holguin Arboleda ]
[ September 21, 2008: Message edited by: Carlos Andres Holguin Arboleda ]