Search in sources :

Example 1 with OrderService

use of com.dangdang.ddframe.rdb.sharding.example.jdbc.service.OrderService in project sharding-jdbc by dangdangdotcom.

the class Main method main.

public static void main(final String[] args) {
    // CHECKSTYLE:ON
    ApplicationContext applicationContext = new ClassPathXmlApplicationContext("META-INF/mybatisContext.xml");
    OrderService orderService = applicationContext.getBean(OrderService.class);
    orderService.clear();
    orderService.fooService();
    orderService.select();
    //[order_id: , user_id: 10, status: UPDATED, order_id: , user_id: 11, status: UPDATED]
    orderService.clear();
    try {
        orderService.fooServiceWithFailure();
    } catch (final IllegalArgumentException e) {
        System.out.println("roll back");
    }
    //[]
    orderService.select();
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) OrderService(com.dangdang.ddframe.rdb.sharding.example.jdbc.service.OrderService)

Aggregations

OrderService (com.dangdang.ddframe.rdb.sharding.example.jdbc.service.OrderService)1 ApplicationContext (org.springframework.context.ApplicationContext)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1