Loading sharding-jdbc-example/sharding-example/sharding-spring-namespace-jpa-example/src/main/resources/META-INF/application-master-slave.xml +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ <bean id="demo_ds_slave_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_1?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_1?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/java/io/shardingsphere/example/spring/namespace/mybatis/SpringNamespaceExample.java +4 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringNamespaceExample { private static final String CONFIG_FILE = "META-INF/application-sharding-databases.xml"; // private static final String CONFIG_FILE = "META-INF/application-sharding-tables.xml"; // private static final String CONFIG_FILE = "META-INF/application-sharding-databases-tables.xml"; // private static final String CONFIG_FILE = "META-INF/application-master-slave.xml"; // private static final String CONFIG_FILE = "META-INF/application-sharding-master-slave.xml"; public static void main(final String[] args) { try (ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(CONFIG_FILE)) { Loading sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/resources/META-INF/application-master-slave.xml +2 −2 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ <bean id="demo_ds_master" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_master?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_master?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> <bean id="demo_ds_slave_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_0?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_0?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/resources/META-INF/application-sharding-databases-tables.xml +6 −3 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ <bean id="demo_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> <bean id="demo_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading @@ -41,9 +41,12 @@ <sharding:table-rule logic-table="t_order" actual-data-nodes="demo_ds_${0..1}.t_order_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderTableStrategy" key-generator-ref="orderKeyGenerator" /> <sharding:table-rule logic-table="t_order_item" actual-data-nodes="demo_ds_${0..1}.t_order_item_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderItemTableStrategy" key-generator-ref="itemKeyGenerator" /> </sharding:table-rules> <sharding:broadcast-table-rules> <sharding:broadcast-table-rule table="t_country" /> </sharding:broadcast-table-rules> </sharding:sharding-rule> <sharding:props> <prop key="sql.show">true</prop> <prop key="sql.show">false</prop> </sharding:props> </sharding:data-source> Loading sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/resources/META-INF/application-sharding-databases.xml +5 −2 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ <bean id="demo_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> <bean id="demo_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading @@ -39,6 +39,9 @@ <sharding:table-rule logic-table="t_order" database-strategy-ref="databaseStrategy" key-generator-ref="orderKeyGenerator" /> <sharding:table-rule logic-table="t_order_item" database-strategy-ref="databaseStrategy" key-generator-ref="itemKeyGenerator" /> </sharding:table-rules> <sharding:broadcast-table-rules> <sharding:broadcast-table-rule table="t_country" /> </sharding:broadcast-table-rules> </sharding:sharding-rule> </sharding:data-source> Loading Loading
sharding-jdbc-example/sharding-example/sharding-spring-namespace-jpa-example/src/main/resources/META-INF/application-master-slave.xml +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ <bean id="demo_ds_slave_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_1?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_1?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading
sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/java/io/shardingsphere/example/spring/namespace/mybatis/SpringNamespaceExample.java +4 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,10 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringNamespaceExample { private static final String CONFIG_FILE = "META-INF/application-sharding-databases.xml"; // private static final String CONFIG_FILE = "META-INF/application-sharding-tables.xml"; // private static final String CONFIG_FILE = "META-INF/application-sharding-databases-tables.xml"; // private static final String CONFIG_FILE = "META-INF/application-master-slave.xml"; // private static final String CONFIG_FILE = "META-INF/application-sharding-master-slave.xml"; public static void main(final String[] args) { try (ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(CONFIG_FILE)) { Loading
sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/resources/META-INF/application-master-slave.xml +2 −2 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ <bean id="demo_ds_master" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_master?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_master?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> <bean id="demo_ds_slave_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_0?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_slave_0?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading
sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/resources/META-INF/application-sharding-databases-tables.xml +6 −3 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ <bean id="demo_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> <bean id="demo_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading @@ -41,9 +41,12 @@ <sharding:table-rule logic-table="t_order" actual-data-nodes="demo_ds_${0..1}.t_order_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderTableStrategy" key-generator-ref="orderKeyGenerator" /> <sharding:table-rule logic-table="t_order_item" actual-data-nodes="demo_ds_${0..1}.t_order_item_${0..1}" database-strategy-ref="databaseStrategy" table-strategy-ref="orderItemTableStrategy" key-generator-ref="itemKeyGenerator" /> </sharding:table-rules> <sharding:broadcast-table-rules> <sharding:broadcast-table-rule table="t_country" /> </sharding:broadcast-table-rules> </sharding:sharding-rule> <sharding:props> <prop key="sql.show">true</prop> <prop key="sql.show">false</prop> </sharding:props> </sharding:data-source> Loading
sharding-jdbc-example/sharding-example/sharding-spring-namespace-mybatis-example/src/main/resources/META-INF/application-sharding-databases.xml +5 −2 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ <bean id="demo_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_0?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> <bean id="demo_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/demo_ds_1?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> Loading @@ -39,6 +39,9 @@ <sharding:table-rule logic-table="t_order" database-strategy-ref="databaseStrategy" key-generator-ref="orderKeyGenerator" /> <sharding:table-rule logic-table="t_order_item" database-strategy-ref="databaseStrategy" key-generator-ref="itemKeyGenerator" /> </sharding:table-rules> <sharding:broadcast-table-rules> <sharding:broadcast-table-rule table="t_country" /> </sharding:broadcast-table-rules> </sharding:sharding-rule> </sharding:data-source> Loading