We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shardingContext-rdb.xml配置:
<context:component-scan base-package="com.dangdang.ddframe.rdb.sharding.example.jdbc"/> <bean id="ds_0" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/ds_0"/> <property name="username" value="root"/> <property name="password" value="root"/> </bean> <bean id="ds_1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/ds_1"/> <property name="username" value="root"/> <property name="password" value="root"/> </bean> <rdb:strategy id="databaseStrategy" sharding-columns="user_id" algorithm-expression="ds_${user_id.longValue() % 2}"/> <rdb:strategy id="orderTableStrategy" sharding-columns="order_id" algorithm-expression="t_order_${order_id.longValue() % 2}"/> <rdb:strategy id="orderItemTableStrategy" sharding-columns="order_id" algorithm-class="com.dangdang.ddframe.rdb.sharding.example.jdbc.algorithm.SingleKeyModuloTableShardingAlgorithm"/> <rdb:data-source id="shardingDataSource"> <rdb:sharding-rule data-sources="ds_0,ds_1"> <rdb:table-rules> <rdb:table-rule logic-table="t_order" actual-tables="t_order_${0..1}" database-strategy="databaseStrategy" table-strategy="orderTableStrategy"/> <rdb:table-rule logic-table="t_order_item" actual-tables="t_order_item_0,t_order_item_1" database-strategy="databaseStrategy" table-strategy="orderItemTableStrategy"/> </rdb:table-rules> </rdb:sharding-rule> <rdb:props> <prop key="metrics.enable">false</prop> </rdb:props> </rdb:data-source>
The text was updated successfully, but these errors were encountered:
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="shardingDataSource" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" />
少配置了事务管理导致的
Sorry, something went wrong.
No branches or pull requests
shardingContext-rdb.xml配置:
The text was updated successfully, but these errors were encountered: