try {
<BUG>log.error("Failed to commit transaction, attempting rollback...");
</BUG>
tx.rollback();
} catch (Exception e) {
<BUG>log.error("Failed to rollback transaction: " + e.getMessage(), e);
</BUG>
}
} else {
<BUG>log.warn("Cannot roll back, transaction is null");
</BUG>
}

try {
session.close();
} catch (Exception e) {
LOG.error("Failed to close session: ", e);
}
} else {
LOG.warn("Session is null, cannot close");
