@@ -0,0 +1,3028 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.example.repository.jdbc.service;%0A%0Aimport io.shardingsphere.example.repository.api.entity.Order;%0Aimport io.shardingsphere.example.repository.api.entity.OrderItem;%0Aimport io.shardingsphere.example.repository.jdbc.repository.XaOrderItemRepository;%0Aimport io.shardingsphere.example.repository.jdbc.repository.XaOrderRepository;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class XaDemoService %7B%0A    %0A    private final XaOrderRepository xaOrderRepository;%0A    %0A    private final XaOrderItemRepository xaOrderItemRepository;%0A    %0A    public XaDemoService(final XaOrderRepository xaOrderRepository, final XaOrderItemRepository xaOrderItemRepository) %7B%0A        this.xaOrderRepository = xaOrderRepository;%0A        this.xaOrderItemRepository = xaOrderItemRepository;%0A    %7D%0A    %0A    public void demo() %7B%0A        xaOrderRepository.createTableIfNotExists();%0A        xaOrderItemRepository.createTableIfNotExists();%0A        xaOrderRepository.truncateTable();%0A        xaOrderItemRepository.truncateTable();%0A        List%3CLong%3E orderIds = new ArrayList%3C%3E(10);%0A        System.out.println(%221.Insert--------------%22);%0A        for (int i = 0; i %3C 10; i++) %7B%0A            Order order = new Order();%0A            order.setUserId(51);%0A            order.setStatus(%22INSERT_TEST%22);%0A            xaOrderRepository.insert(order);%0A            long orderId = order.getOrderId();%0A            orderIds.add(orderId);%0A            %0A            OrderItem item = new OrderItem();%0A            item.setOrderId(orderId);%0A            item.setUserId(51);%0A            item.setStatus(%22INSERT_TEST%22);%0A            xaOrderItemRepository.insert(item);%0A        %7D%0A        System.out.println(%22Order Data--------------%22);%0A        System.out.println(xaOrderRepository.selectAll());%0A        System.out.println(%22OrderItem Data--------------%22);%0A        System.out.println(xaOrderItemRepository.selectAll());%0A        System.out.println(%222.Delete--------------%22);%0A        for (Long each : orderIds) %7B%0A            xaOrderRepository.delete(each);%0A            xaOrderItemRepository.delete(each);%0A        %7D%0A        System.out.println(%22Order Data--------------%22);%0A        System.out.println(xaOrderRepository.selectAll());%0A        System.out.println(%22OrderItem Data--------------%22);%0A        System.out.println(xaOrderItemRepository.selectAll());%0A        xaOrderItemRepository.dropTable();%0A        xaOrderRepository.dropTable();%0A    %7D%0A%7D%0A

add XaDemoService.java