Skip to content
This repository was archived by the owner on Aug 15, 2020. It is now read-only.
This repository was archived by the owner on Aug 15, 2020. It is now read-only.

JDBC can rollback , but Mybatis can't #207

@SmallBeautifulPig

Description

@SmallBeautifulPig

When I was testing the official sharding-seata demo ,the following problems are encountered.

private static Long insertOrder(final Connection connection, final Order order) { String sql = "INSERT INTO t_order (user_id, address_id, status) VALUES (?, ?, ?)"; try (PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { preparedStatement.setObject(1, order.getUserId()); preparedStatement.setObject(2, order.getAddressId()); preparedStatement.setObject(3, order.getStatus()); preparedStatement.executeUpdate(); try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { if (resultSet.next()) { order.setOrderId(resultSet.getLong(1)); } } } catch (final SQLException ignored) { } return order.getOrderId(); }

the original JDBC can rollback . but when replaced by mybatis , it can't be rollbacked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions