Commit 457bd35c authored by tristaZero's avatar tristaZero
Browse files

ShardingOnlyWithDatabasesAndTables.java

parent d7ae5e8a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import io.shardingsphere.example.jdbc.fixture.algorithm.ModuloShardingTableAlgor
import io.shardingsphere.example.jdbc.util.DataSourceUtil;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderItemRepository;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderRepository;
import io.shardingsphere.example.repository.jdbc.service.DemoService;
import io.shardingsphere.example.repository.jdbc.service.RawDemoService;
import io.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory;

import javax.sql.DataSource;
@@ -38,7 +38,7 @@ public class ShardingOnlyWithDatabasesAndTables {
    
    public static void main(final String[] args) throws SQLException {
        DataSource dataSource = getDataSource();
        new DemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        new RawDemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
    }
    
    private static DataSource getDataSource() throws SQLException {
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package io.shardingsphere.example.jdbc.main.nodep.yaml;

import io.shardingsphere.example.repository.jdbc.repository.RawOrderItemRepository;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderRepository;
import io.shardingsphere.example.repository.jdbc.service.DemoService;
import io.shardingsphere.example.repository.jdbc.service.RawDemoService;
import io.shardingsphere.shardingjdbc.api.yaml.YamlShardingDataSourceFactory;

import javax.sql.DataSource;
@@ -29,7 +29,7 @@ public class ShardingOnlyWithDatabasesAndTables {
    
    public static void main(final String[] args) throws Exception {
        DataSource dataSource = YamlShardingDataSourceFactory.createDataSource(getYamlFile());
        new DemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        new RawDemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
    }
    
    private static File getYamlFile() {
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import io.shardingsphere.example.jdbc.fixture.algorithm.ModuloShardingTableAlgor
import io.shardingsphere.example.jdbc.util.DataSourceUtil;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderItemRepository;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderRepository;
import io.shardingsphere.example.repository.jdbc.service.DemoService;
import io.shardingsphere.example.repository.jdbc.service.RawDemoService;
import io.shardingsphere.orchestration.config.OrchestrationConfiguration;
import io.shardingsphere.orchestration.config.OrchestrationType;
import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
@@ -47,7 +47,7 @@ public class ShardingOnlyWithDatabasesAndTables {
    
    public static void main(final String[] args) throws SQLException {
        DataSource dataSource = getDataSource();
        new DemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        new RawDemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        ((OrchestrationShardingDataSource) dataSource).close();
    }
    
+2 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import io.shardingsphere.example.jdbc.fixture.algorithm.ModuloShardingTableAlgor
import io.shardingsphere.example.jdbc.util.DataSourceUtil;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderItemRepository;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderRepository;
import io.shardingsphere.example.repository.jdbc.service.DemoService;
import io.shardingsphere.example.repository.jdbc.service.RawDemoService;
import io.shardingsphere.orchestration.config.OrchestrationConfiguration;
import io.shardingsphere.orchestration.config.OrchestrationType;
import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
@@ -49,7 +49,7 @@ public class ShardingOnlyWithDatabasesAndTables {
    
    public static void main(final String[] args) throws SQLException {
        DataSource dataSource = getDataSource();
        new DemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        new RawDemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        ((OrchestrationShardingDataSource) dataSource).close();
    }
    
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ package io.shardingsphere.example.jdbc.main.orche.yaml.etcd;
import io.shardingsphere.example.jdbc.main.orche.yaml.zookeeper.ShardingOnlyWithTables;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderItemRepository;
import io.shardingsphere.example.repository.jdbc.repository.RawOrderRepository;
import io.shardingsphere.example.repository.jdbc.service.DemoService;
import io.shardingsphere.example.repository.jdbc.service.RawDemoService;
import io.shardingsphere.shardingjdbc.orchestration.api.yaml.YamlOrchestrationShardingDataSourceFactory;
import io.shardingsphere.shardingjdbc.orchestration.internal.datasource.OrchestrationShardingDataSource;

@@ -33,7 +33,7 @@ public class ShardingOnlyWithDatabasesAndTables {
    
    public static void main(final String[] args) throws Exception {
        DataSource dataSource = YamlOrchestrationShardingDataSourceFactory.createDataSource(getYamlFile());
        new DemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        new RawDemoService(new RawOrderRepository(dataSource), new RawOrderItemRepository(dataSource)).demo();
        ((OrchestrationShardingDataSource) dataSource).close();
    }
    
Loading