//….
finally
{
    if( trx != null )
    {
        trx.rollback();
    }
}