This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 8aa2604  Add springboot starter jpa template (#13068)
8aa2604 is described below

commit 8aa2604aa2d4f48112dec2c18238b6b54b703f90
Author: Guocheng Tang <[email protected]>
AuthorDate: Sat Oct 16 22:34:49 2021 +0800

    Add springboot starter jpa template (#13068)
    
    * Add springboot starter jpa template
    
    * Add springboot starter jpa template
---
 .../example/engine/ExampleGenerateEngine.java      | 21 ++++--
 .../template/springboot-starter-jpa/Example.ftl    | 39 ++++++++++
 .../springboot-starter-jpa/ExampleService.ftl      | 87 ++++++++++++++++++++++
 .../template/springboot-starter-jpa/Repository.ftl | 70 +++++++++++++++++
 .../template/springboot-starter-jpa/datamodel.yaml | 22 ++++++
 .../springboot-starter-jpa/entity/Order.ftl        | 84 +++++++++++++++++++++
 .../springboot-starter-jpa/entity/OrderItem.ftl    | 84 +++++++++++++++++++++
 .../pom.xml                                        |  1 +
 .../pom.xml                                        | 35 ++++++---
 ...ryLocalShardingSpringbootStarterJpaExample.java | 35 +++++++++
 ...ShardingSpringbootStarterJpaExampleService.java | 83 +++++++++++++++++++++
 ...ocalShardingSpringbootStarterJpaRepository.java | 67 +++++++++++++++++
 .../springboot/starter/jpa/entity/Order.java       | 84 +++++++++++++++++++++
 .../springboot/starter/jpa/entity/OrderItem.java   | 84 +++++++++++++++++++++
 .../src/main/resources/application.properties      | 73 ++++++++++++++++++
 15 files changed, 853 insertions(+), 16 deletions(-)

diff --git 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/java/org/apache/sharding/example/engine/ExampleGenerateEngine.java
 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/java/org/apache/sharding/example/engine/ExampleGenerateEngine.java
index 0bfe8b4..95f5573 100644
--- 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/java/org/apache/sharding/example/engine/ExampleGenerateEngine.java
+++ 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/java/org/apache/sharding/example/engine/ExampleGenerateEngine.java
@@ -48,14 +48,18 @@ public final class ExampleGenerateEngine {
             "<#list framework?split(\"-\") as framework1>" +
             "<#assign frameworkName=frameworkName + framework1?cap_first>" +
             "</#list>${frameworkName}";
-    private static final Map<String, String> TEMPLATE_MAP = new HashMap(4, 1);
+    private static final Map<String, String> RENAME_TEMPLATE_MAP = new 
HashMap(4, 1);
+    
+    private static final Map<String, String> UN_NAME_TEMPLATE_MAP = new 
HashMap<>(3, 1);
     static {
         try {
             CONFIGURATION.setDirectoryForTemplateLoading(new 
File(ExampleGenerateEngine.class.getClassLoader().getResource("").getFile()));
             CONFIGURATION.setDefaultEncoding("UTF-8");
-            //TEMPLATE_MAP.put("Configuration", "Configuration.ftl");
-            TEMPLATE_MAP.put("Example", "Example.ftl");
-            TEMPLATE_MAP.put("ExampleService", "ExampleService.ftl");
+            RENAME_TEMPLATE_MAP.put("Repository", "Repository.ftl");
+            RENAME_TEMPLATE_MAP.put("Example", "Example.ftl");
+            RENAME_TEMPLATE_MAP.put("ExampleService", "ExampleService.ftl");
+            UN_NAME_TEMPLATE_MAP.put("entity/Order", "entity/Order.ftl");
+            UN_NAME_TEMPLATE_MAP.put("entity/OrderItem", 
"entity/OrderItem.ftl");
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -96,12 +100,15 @@ public final class ExampleGenerateEngine {
     
     public static void main(String[] args) {
         Yaml yaml = new Yaml();
-        InputStream in = 
ExampleGenerateEngine.class.getResourceAsStream("/template/springboot-starter-jdbc/datamodel.yaml");
+        InputStream in = 
ExampleGenerateEngine.class.getResourceAsStream("/template/springboot-starter-jpa/datamodel.yaml");
         Map<String, String> map = yaml.loadAs(in, Map.class);
         String fileName = processString(map, FILE_NAME_PREFIX);
         String outputPath = processString(map, OUTPUT_PATH);
-        for (String key : TEMPLATE_MAP.keySet()) {
-            processFile(map, "/template/springboot-starter-jdbc/" + 
TEMPLATE_MAP.get(key), outputPath + "/" + fileName + key + ".java");
+        for (String key : RENAME_TEMPLATE_MAP.keySet()) {
+            processFile(map, "/template/springboot-starter-jpa/" + 
RENAME_TEMPLATE_MAP.get(key), outputPath + "/" + fileName + key + ".java");
+        }
+        for (String key : UN_NAME_TEMPLATE_MAP.keySet()) {
+            processFile(map, "/template/springboot-starter-jpa/" + 
UN_NAME_TEMPLATE_MAP.get(key), outputPath + "/" + key + ".java");
         }
     }
 }
diff --git 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/Example.ftl
 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/Example.ftl
new file mode 100644
index 0000000..d1a50dd
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/Example.ftl
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.example.${feature}.springboot.starter.jpa;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.context.ConfigurableApplicationContext;
+
+<#assign frameworkName="">
+<#list framework?split("-") as framework1>
+    <#assign frameworkName=frameworkName + framework1?cap_first>
+</#list>
+@EntityScan(basePackages = 
"org.apache.shardingsphere.example.${feature}.springboot.starter.jpa.entity")
+@SpringBootApplication
+public class 
${mode?cap_first}${transaction?cap_first}${feature?cap_first}${frameworkName}Example
 {
+    
+    public static void main(String[] args) {
+        try (ConfigurableApplicationContext applicationContext = 
SpringApplication.run(${mode?cap_first}${transaction?cap_first}${feature?cap_first}${frameworkName}Example.class,
 args)) {
+            
${mode?cap_first}${transaction?cap_first}${feature?cap_first}${frameworkName}ExampleService
 exampleService = 
applicationContext.getBean(${mode?cap_first}${transaction?cap_first}${feature?cap_first}${frameworkName}ExampleService.class);
+            exampleService.processSuccess();
+        }
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/ExampleService.ftl
 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/ExampleService.ftl
new file mode 100644
index 0000000..be972d1
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/ExampleService.ftl
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.example.${feature}.springboot.starter.jpa;
+
+import 
org.apache.shardingsphere.example.${feature}.springboot.starter.jpa.entity.Order;
+import 
org.apache.shardingsphere.example.${feature}.springboot.starter.jpa.entity.OrderItem;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+<#assign frameworkName="">
+<#list framework?split("-") as framework1>
+    <#assign frameworkName=frameworkName + framework1?cap_first>
+</#list>
+@Service
+public final class 
${mode?cap_first}${transaction?cap_first}${feature?cap_first}${frameworkName}ExampleService
 {
+    
+    @Resource
+    private 
${mode?cap_first}${transaction?cap_first}${feature?cap_first}${frameworkName}Repository
 repository;
+
+    /**
+     * Execute test.
+     */
+    public void processSuccess() {
+        System.out.println("-------------- Process Success Begin 
---------------");
+        List<Long> orderIds = insertData();
+        printData(); 
+        deleteData(orderIds);
+        printData();
+        System.out.println("-------------- Process Success Finish 
--------------");
+    }
+
+    private List<Long> insertData() {
+        System.out.println("---------------------------- Insert Data 
----------------------------");
+        List<Long> result = new ArrayList<>(10);
+        for (int i = 1; i <= 10; i++) {
+            Order order = new Order();
+            order.setUserId(i);
+            order.setAddressId(i);
+            order.setStatus("INSERT_TEST");
+            repository.insertOrder(order);
+            OrderItem orderItem = new OrderItem();
+            orderItem.setOrderId(order.getOrderId());
+            orderItem.setUserId(i);
+            orderItem.setStatus("INSERT_TEST");
+            repository.insertOrderItem(orderItem);
+            result.add(order.getOrderId());
+        }
+        return result;
+    }
+
+    private void deleteData(final List<Long> orderIds) {
+        System.out.println("---------------------------- Delete Data 
----------------------------");
+        for (Long each : orderIds) {
+            repository.deleteOrder(each);
+            repository.deleteOrderItem(each);
+        }
+    }
+    
+    private void printData() {
+        System.out.println("---------------------------- Print Order Data 
-----------------------");
+        for (Object each : repository.selectAllOrder()) {
+            System.out.println(each);
+        }
+        System.out.println("---------------------------- Print OrderItem Data 
-------------------");
+        for (Object each : repository.selectAllOrderItem()) {
+            System.out.println(each);
+        }
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/Repository.ftl
 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/Repository.ftl
new file mode 100644
index 0000000..1c31a2c
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/Repository.ftl
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.example.${feature}.springboot.starter.jpa;
+
+import 
org.apache.shardingsphere.example.${feature}.springboot.starter.jpa.entity.Order;
+import 
org.apache.shardingsphere.example.${feature}.springboot.starter.jpa.entity.OrderItem;
+import org.springframework.stereotype.Repository;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.transaction.Transactional;
+import java.util.List;
+
+<#assign frameworkName="">
+<#list framework?split("-") as framework1>
+    <#assign frameworkName=frameworkName + framework1?cap_first>
+</#list>
+@Repository
+@Transactional
+public class 
${mode?cap_first}${transaction?cap_first}${feature?cap_first}${frameworkName}Repository
 {
+    
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    public Long insertOrder(final Order order) {
+        entityManager.persist(order);
+        return order.getOrderId();
+    }
+
+    public Long insertOrderItem(final OrderItem orderItem) {
+        entityManager.persist(orderItem);
+        return orderItem.getOrderItemId();
+    }
+    
+    public List<Order> selectAllOrder() {
+        return (List<Order>) entityManager.createQuery("SELECT o FROM Order 
o").getResultList();
+    }
+    
+    public List<OrderItem> selectAllOrderItem() {
+        return (List<OrderItem>) entityManager.createQuery("SELECT o from 
OrderItem o").getResultList();
+    }
+
+    public void deleteOrder(final Long orderId) {
+        Query query = entityManager.createQuery("DELETE FROM Order o WHERE 
o.orderId = ?1");
+        query.setParameter(1, orderId);
+        query.executeUpdate();
+    }
+
+    public void deleteOrderItem(final Long orderId) {
+        Query query = entityManager.createQuery("DELETE FROM OrderItem i WHERE 
i.orderId = ?1");
+        query.setParameter(1, orderId);
+        query.executeUpdate();
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/datamodel.yaml
 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/datamodel.yaml
new file mode 100644
index 0000000..27d2be1
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/datamodel.yaml
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+mode: memory
+transaction: local
+feature: sharding
+framework: springboot-starter-jpa
+
diff --git 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/entity/Order.ftl
 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/entity/Order.ftl
new file mode 100644
index 0000000..24544dd
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/entity/Order.ftl
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.example.${feature}.springboot.starter.jpa.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "t_order")
+public class Order implements Serializable {
+
+    private static final long serialVersionUID = -5336127407322921657L;
+    
+    @Id
+    @Column(name = "order_id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private long orderId;
+
+    @Column(name = "user_id")
+    private int userId;
+
+    @Column(name = "address_id")
+    private long addressId;
+
+    @Column(name = "status")
+    private String status;
+    
+    public long getOrderId() {
+        return orderId;
+    }
+    
+    public void setOrderId(final long orderId) {
+        this.orderId = orderId;
+    }
+    
+    public int getUserId() {
+        return userId;
+    }
+    
+    public void setUserId(final int userId) {
+        this.userId = userId;
+    }
+    
+    public String getStatus() {
+        return status;
+    }
+    
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+    
+    public long getAddressId() {
+        return addressId;
+    }
+    
+    public void setAddressId(final long addressId) {
+        this.addressId = addressId;
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("order_id: %s, user_id: %s, address_id: %s, 
status: %s", orderId, userId, addressId, status);
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/entity/OrderItem.ftl
 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/entity/OrderItem.ftl
new file mode 100644
index 0000000..ebe8620
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-example-engine/src/main/resources/template/springboot-starter-jpa/entity/OrderItem.ftl
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.example.${feature}.springboot.starter.jpa.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "t_order_item")
+public class OrderItem implements Serializable {
+
+    private static final long serialVersionUID = -5336127407322921657L;
+    
+    @Id
+    @Column(name = "order_item_id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private long orderItemId;
+
+    @Column(name = "order_id")
+    private long orderId;
+    
+    @Column(name = "user_id")
+    private int userId;
+
+    @Column(name = "status")
+    private String status;
+    
+    public long getOrderItemId() {
+        return orderItemId;
+    }
+    
+    public void setOrderItemId(final long orderItemId) {
+        this.orderItemId = orderItemId;
+    }
+    
+    public long getOrderId() {
+        return orderId;
+    }
+    
+    public void setOrderId(final long orderId) {
+        this.orderId = orderId;
+    }
+    
+    public int getUserId() {
+        return userId;
+    }
+    
+    public void setUserId(final int userId) {
+        this.userId = userId;
+    }
+    
+    public String getStatus() {
+        return status;
+    }
+    
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("order_item_id:%s, order_id: %s, user_id: %s, 
status: %s", orderItemId, orderId, userId, status);
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/pom.xml
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/pom.xml
index 8d666c4..9902e22 100644
--- 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/pom.xml
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/pom.xml
@@ -32,6 +32,7 @@
     <modules>
         <module>shardingsphere-jdbc-memory-local-sharding-jdbc-example</module>
         
<module>shardingsphere-jdbc-memory-local-sharding-springboot-starter-jdbc-example</module>
+        
<module>shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example</module>
     </modules>
     
 </project>
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/pom.xml
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/pom.xml
similarity index 55%
copy from 
examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/pom.xml
copy to 
examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/pom.xml
index 8d666c4..642a4b9 100644
--- 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/pom.xml
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/pom.xml
@@ -20,18 +20,35 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <parent>
-        <artifactId>shardingsphere-jdbc-memory-local-example</artifactId>
+        
<artifactId>shardingsphere-jdbc-memory-local-sharding-example</artifactId>
         <groupId>org.apache.shardingsphere.example</groupId>
         <version>5.0.0-RC1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-    <packaging>pom</packaging>
-    <artifactId>shardingsphere-jdbc-memory-local-sharding-example</artifactId>
+    
<artifactId>shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example</artifactId>
     <name>${project.artifactId}</name>
-    
-    <modules>
-        <module>shardingsphere-jdbc-memory-local-sharding-jdbc-example</module>
-        
<module>shardingsphere-jdbc-memory-local-sharding-springboot-starter-jdbc-example</module>
-    </modules>
-    
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate.javax.persistence</groupId>
+            <artifactId>hibernate-jpa-2.1-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+    </dependencies>
 </project>
+
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/MemoryLocalShardingSpringbootStarterJpaExample.java
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-exam
 [...]
new file mode 100644
index 0000000..6fb556a
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/MemoryLocalShardingSpringbootStarterJpaExample.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.example.sharding.springboot.starter.jpa;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.context.ConfigurableApplicationContext;
+
+@EntityScan(basePackages = 
"org.apache.shardingsphere.example.sharding.springboot.starter.jpa.entity")
+@SpringBootApplication
+public class MemoryLocalShardingSpringbootStarterJpaExample {
+    
+    public static void main(String[] args) {
+        try (ConfigurableApplicationContext applicationContext = 
SpringApplication.run(MemoryLocalShardingSpringbootStarterJpaExample.class, 
args)) {
+            MemoryLocalShardingSpringbootStarterJpaExampleService 
exampleService = 
applicationContext.getBean(MemoryLocalShardingSpringbootStarterJpaExampleService.class);
+            exampleService.processSuccess();
+        }
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/MemoryLocalShardingSpringbootStarterJpaExampleService.java
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memo
 [...]
new file mode 100644
index 0000000..2b9c03a
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/MemoryLocalShardingSpringbootStarterJpaExampleService.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.example.sharding.springboot.starter.jpa;
+
+import 
org.apache.shardingsphere.example.sharding.springboot.starter.jpa.entity.Order;
+import 
org.apache.shardingsphere.example.sharding.springboot.starter.jpa.entity.OrderItem;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public final class MemoryLocalShardingSpringbootStarterJpaExampleService {
+    
+    @Resource
+    private MemoryLocalShardingSpringbootStarterJpaRepository repository;
+
+    /**
+     * Execute test.
+     */
+    public void processSuccess() {
+        System.out.println("-------------- Process Success Begin 
---------------");
+        List<Long> orderIds = insertData();
+        printData(); 
+        deleteData(orderIds);
+        printData();
+        System.out.println("-------------- Process Success Finish 
--------------");
+    }
+
+    private List<Long> insertData() {
+        System.out.println("---------------------------- Insert Data 
----------------------------");
+        List<Long> result = new ArrayList<>(10);
+        for (int i = 1; i <= 10; i++) {
+            Order order = new Order();
+            order.setUserId(i);
+            order.setAddressId(i);
+            order.setStatus("INSERT_TEST");
+            repository.insertOrder(order);
+            OrderItem orderItem = new OrderItem();
+            orderItem.setOrderId(order.getOrderId());
+            orderItem.setUserId(i);
+            orderItem.setStatus("INSERT_TEST");
+            repository.insertOrderItem(orderItem);
+            result.add(order.getOrderId());
+        }
+        return result;
+    }
+
+    private void deleteData(final List<Long> orderIds) {
+        System.out.println("---------------------------- Delete Data 
----------------------------");
+        for (Long each : orderIds) {
+            repository.deleteOrder(each);
+            repository.deleteOrderItem(each);
+        }
+    }
+    
+    private void printData() {
+        System.out.println("---------------------------- Print Order Data 
-----------------------");
+        for (Object each : repository.selectAllOrder()) {
+            System.out.println(each);
+        }
+        System.out.println("---------------------------- Print OrderItem Data 
-------------------");
+        for (Object each : repository.selectAllOrderItem()) {
+            System.out.println(each);
+        }
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/MemoryLocalShardingSpringbootStarterJpaRepository.java
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-e
 [...]
new file mode 100644
index 0000000..b9814d2
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/MemoryLocalShardingSpringbootStarterJpaRepository.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.example.sharding.springboot.starter.jpa;
+
+import 
org.apache.shardingsphere.example.sharding.springboot.starter.jpa.entity.Order;
+import 
org.apache.shardingsphere.example.sharding.springboot.starter.jpa.entity.OrderItem;
+import org.springframework.stereotype.Repository;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.transaction.Transactional;
+import java.util.List;
+
+@Repository
+@Transactional
+public class MemoryLocalShardingSpringbootStarterJpaRepository {
+    
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    public Long insertOrder(final Order order) {
+        entityManager.persist(order);
+        return order.getOrderId();
+    }
+
+    public Long insertOrderItem(final OrderItem orderItem) {
+        entityManager.persist(orderItem);
+        return orderItem.getOrderItemId();
+    }
+    
+    public List<Order> selectAllOrder() {
+        return (List<Order>) entityManager.createQuery("SELECT o FROM Order 
o").getResultList();
+    }
+    
+    public List<OrderItem> selectAllOrderItem() {
+        return (List<OrderItem>) entityManager.createQuery("SELECT o from 
OrderItem o").getResultList();
+    }
+
+    public void deleteOrder(final Long orderId) {
+        Query query = entityManager.createQuery("DELETE FROM Order o WHERE 
o.orderId = ?1");
+        query.setParameter(1, orderId);
+        query.executeUpdate();
+    }
+
+    public void deleteOrderItem(final Long orderId) {
+        Query query = entityManager.createQuery("DELETE FROM OrderItem i WHERE 
i.orderId = ?1");
+        query.setParameter(1, orderId);
+        query.executeUpdate();
+    }
+}
+
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/entity/Order.java
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-loc
 [...]
new file mode 100644
index 0000000..6802478
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/entity/Order.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.example.sharding.springboot.starter.jpa.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "t_order")
+public class Order implements Serializable {
+
+    private static final long serialVersionUID = -5336127407322921657L;
+    
+    @Id
+    @Column(name = "order_id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private long orderId;
+
+    @Column(name = "user_id")
+    private int userId;
+
+    @Column(name = "address_id")
+    private long addressId;
+
+    @Column(name = "status")
+    private String status;
+    
+    public long getOrderId() {
+        return orderId;
+    }
+    
+    public void setOrderId(final long orderId) {
+        this.orderId = orderId;
+    }
+    
+    public int getUserId() {
+        return userId;
+    }
+    
+    public void setUserId(final int userId) {
+        this.userId = userId;
+    }
+    
+    public String getStatus() {
+        return status;
+    }
+    
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+    
+    public long getAddressId() {
+        return addressId;
+    }
+    
+    public void setAddressId(final long addressId) {
+        this.addressId = addressId;
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("order_id: %s, user_id: %s, address_id: %s, 
status: %s", orderId, userId, addressId, status);
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/entity/OrderItem.java
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory
 [...]
new file mode 100644
index 0000000..6f4eb20
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/java/org/apache/shardingsphere/example/sharding/springboot/starter/jpa/entity/OrderItem.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package 
org.apache.shardingsphere.example.sharding.springboot.starter.jpa.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+@Entity
+@Table(name = "t_order_item")
+public class OrderItem implements Serializable {
+
+    private static final long serialVersionUID = -5336127407322921657L;
+    
+    @Id
+    @Column(name = "order_item_id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private long orderItemId;
+
+    @Column(name = "order_id")
+    private long orderId;
+    
+    @Column(name = "user_id")
+    private int userId;
+
+    @Column(name = "status")
+    private String status;
+    
+    public long getOrderItemId() {
+        return orderItemId;
+    }
+    
+    public void setOrderItemId(final long orderItemId) {
+        this.orderItemId = orderItemId;
+    }
+    
+    public long getOrderId() {
+        return orderId;
+    }
+    
+    public void setOrderId(final long orderId) {
+        this.orderId = orderId;
+    }
+    
+    public int getUserId() {
+        return userId;
+    }
+    
+    public void setUserId(final int userId) {
+        this.userId = userId;
+    }
+    
+    public String getStatus() {
+        return status;
+    }
+    
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+    
+    @Override
+    public String toString() {
+        return String.format("order_item_id:%s, order_id: %s, user_id: %s, 
status: %s", orderItemId, orderId, userId, status);
+    }
+}
diff --git 
a/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/resources/application.properties
 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-exa
 [...]
new file mode 100644
index 0000000..ef42033
--- /dev/null
+++ 
b/examples/shardingsphere-sample/shardingsphere-jdbc-sample/shardingsphere-jdbc-memory-example/shardingsphere-jdbc-memory-local-example/shardingsphere-jdbc-memory-local-sharding-example/shardingsphere-jdbc-memory-local-sharding-springboot-starter-jpa-example/src/main/resources/application.properties
@@ -0,0 +1,73 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
+spring.jpa.properties.hibernate.show_sql=false
+
+spring.shardingsphere.schema.name=sharding
+
+spring.shardingsphere.datasource.names=ds-0,ds-1
+
+spring.shardingsphere.datasource.ds-0.type=com.zaxxer.hikari.HikariDataSource
+spring.shardingsphere.datasource.ds-0.driver-class-name=com.mysql.jdbc.Driver
+spring.shardingsphere.datasource.ds-0.jdbc-url=jdbc:mysql://localhost:3307/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+spring.shardingsphere.datasource.ds-0.username=root
+spring.shardingsphere.datasource.ds-0.password=123456
+spring.shardingsphere.datasource.ds-0.max-active=16
+
+spring.shardingsphere.datasource.ds-1.type=com.zaxxer.hikari.HikariDataSource
+spring.shardingsphere.datasource.ds-1.driver-class-name=com.mysql.jdbc.Driver
+spring.shardingsphere.datasource.ds-1.jdbc-url=jdbc:mysql://localhost:3307/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+spring.shardingsphere.datasource.ds-1.username=root
+spring.shardingsphere.datasource.ds-1.password=123456
+spring.shardingsphere.datasource.ds-1.max-active=16
+
+spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=user_id
+spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=database-inline
+
+spring.shardingsphere.rules.sharding.binding-tables=t_order,t_order_item
+spring.shardingsphere.rules.sharding.broadcast-tables=t_address
+
+spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds-$->{0..1}.t_order_$->{0..1}
+spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
+spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=t-order-inline
+        
+spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.column=order_id
+spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.key-generator-name=snowflake
+
+spring.shardingsphere.rules.sharding.tables.t_order_item.actual-data-nodes=ds-$->{0..1}.t_order_item_$->{0..1}
+spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-column=order_id
+spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-algorithm-name=t-order-item-inline
+
+spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.column=order_item_id
+spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.key-generator-name=snowflake
+
+spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.type=INLINE
+spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.props.algorithm-expression=ds-$->{user_id
 % 2}
+spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.type=INLINE
+spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.props.algorithm-expression=t_order_$->{order_id
 % 2}
+spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.type=INLINE
+spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-item-inline.props.algorithm-expression=t_order_item_$->{order_id
 % 2}
+
+spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE
+spring.shardingsphere.rules.sharding.key-generators.snowflake.props.worker-id=123
+
+spring.shardingsphere.rules.encrypt.encryptors.status-encryptor.type=AES
+spring.shardingsphere.rules.encrypt.encryptors.status-encryptor.props.aes-key-value=123456
+spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.cipher-column=status
+spring.shardingsphere.rules.encrypt.tables.t_order.columns.status.encryptor-name=status-encryptor

Reply via email to