Search in sources :

Example 1 with DefaultNameConversion

use of org.beetl.sql.core.DefaultNameConversion in project nutzboot by nutzam.

the class BeetlSqlStarter method creatSQLManager.

@IocBean(name = "beetlsqlManager")
public SQLManager creatSQLManager(@Inject("refer:beetlsqlDBStyle") DBStyle dbStyle, @Inject("beetlsqlConnectionSource") ConnectionSource ds) {
    // BeetlSql默认/sql/,但NutzBoot的约定是/sqls/,入乡随俗吧
    SQLLoader loader = new ClasspathLoader(conf.get(PROP_PATH, "/sqls/"));
    // TODO 支持更多种类的NameConversion
    NameConversion nameconv = "default".equals(conf.get(PROP_NAME_CONVERSION, "default")) ? new DefaultNameConversion() : new UnderlinedNameConversion();
    // 是否插入debug拦截器呢? 默认启用好了
    if (conf.getBoolean(PROP_DEBUG, true))
        return new SQLManager(dbStyle, loader, ds, nameconv, new Interceptor[] { new DebugInterceptor() });
    return new SQLManager(dbStyle, loader, ds, nameconv);
}
Also used : NameConversion(org.beetl.sql.core.NameConversion) UnderlinedNameConversion(org.beetl.sql.core.UnderlinedNameConversion) DefaultNameConversion(org.beetl.sql.core.DefaultNameConversion) SQLLoader(org.beetl.sql.core.SQLLoader) ClasspathLoader(org.beetl.sql.core.ClasspathLoader) DebugInterceptor(org.beetl.sql.ext.DebugInterceptor) UnderlinedNameConversion(org.beetl.sql.core.UnderlinedNameConversion) DefaultNameConversion(org.beetl.sql.core.DefaultNameConversion) Interceptor(org.beetl.sql.core.Interceptor) DebugInterceptor(org.beetl.sql.ext.DebugInterceptor) SQLManager(org.beetl.sql.core.SQLManager) IocBean(org.nutz.ioc.loader.annotation.IocBean)

Aggregations

ClasspathLoader (org.beetl.sql.core.ClasspathLoader)1 DefaultNameConversion (org.beetl.sql.core.DefaultNameConversion)1 Interceptor (org.beetl.sql.core.Interceptor)1 NameConversion (org.beetl.sql.core.NameConversion)1 SQLLoader (org.beetl.sql.core.SQLLoader)1 SQLManager (org.beetl.sql.core.SQLManager)1 UnderlinedNameConversion (org.beetl.sql.core.UnderlinedNameConversion)1 DebugInterceptor (org.beetl.sql.ext.DebugInterceptor)1 IocBean (org.nutz.ioc.loader.annotation.IocBean)1