package com.zanxiang.game.data.serve.config;

import com.zanxiang.game.data.serve.config.nutz.SpringNutzDaoRunner;
import org.nutz.dao.impl.NutDao;
import org.nutz.dao.util.Daos;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.sql.DataSource;

@Configuration
@EnableTransactionManagement
public class NutzDaoConfig {

    @Bean
    public NutDao nutzDao(DataSource dataSource) {
        Daos.FORCE_HUMP_COLUMN_NAME = true;
        NutDao nutDao = new NutDao(dataSource);
        nutDao.setRunner(new SpringNutzDaoRunner());
        return nutDao;
    }
}
