package com.dmnlk.doma;

import org.seasar.doma.SingletonConfig;
import org.seasar.doma.jdbc.Config;
import org.seasar.doma.jdbc.dialect.Dialect;
import org.seasar.doma.jdbc.dialect.PostgresDialect;

import javax.sql.DataSource;

/**
 * @author dmnlk
 */
@SingletonConfig
public class AppConfig implements Config {
    private static final AppConfig CONFIG = new AppConfig();
    private final Dialect dialect;
    @Override
    public DataSource getDataSource() {
        return null;
    }

    @Override
    public Dialect getDialect() {
        return dialect;
    }

    private AppConfig() {
        dialect = new PostgresDialect();
    }

    public static AppConfig singleton() {
        return CONFIG;
    }
}

@@ -191,16 +191,75 @@
 Dialect;
+%0Aimport org.seasar.doma.jdbc.tx.LocalTransactionDataSource;
 %0A%0Aimport
@@ -459,24 +459,65 @@
 ct dialect;%0A
+    private final DataSource dataSource;%0A
     @Overrid
@@ -577,12 +577,18 @@
 urn 
-null
+dataSource
 ;%0A  
@@ -693,24 +693,24 @@
 pConfig() %7B%0A
-
         dial
@@ -734,24 +734,107 @@
 sDialect();%0A
+        dataSource = new LocalTransactionDataSource(%22jdbc/posgres%22, %22user%22, null);%0A
     %7D%0A%0A    p

return datasource