Sharding-JDBC中的路由结果是通过分片字段和分片方法来确定的。
Sharding-Jdbc和MyCat查询原理大致相同:
示例代码:
public interface OrderRepository extends CrudRepository{ @Query(value = "SELECT order_id ,user_id FROM t_order where order_id in (?1);", nativeQuery = true) public ListfindExpiredOrderState(List @Query(value = "SELECT order_id ,user_id FROM t_order where user_id=:userId ", nativeQuery = true) public ListbpIds); findByUserId(@Param("userId") Long userId);
本文地址:https://www.0558.la/article/1b9b00def1b6c051e76a.html