当前位置: 首页>>代码示例>>Java>>正文


Java Config类代码示例

本文整理汇总了Java中org.seasar.doma.jdbc.Config的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Config类属于org.seasar.doma.jdbc包,在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: delete

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
default int delete(Invitation invitation) {
    Config config = Config.get(this);
    DeleteBuilder.newInstance(config)
            .sql("DELETE FROM group_invitations ")
            .sql("WHERE invitation_id = ")
            .param(long.class, invitation.getId())
            .execute();

    DeleteBuilder.newInstance(config)
            .sql("DELETE FROM oidc_invitations ")
            .sql("WHERE invitation_id = ")
            .param(long.class, invitation.getId())
            .execute();

    return DeleteBuilder.newInstance(config)
            .sql("DELETE FROM invitations ")
            .sql("WHERE invitation_id = ")
            .param(long.class, invitation.getId())
            .execute();
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:21,代码来源:InvitationDao.java

示例2: setUpDatabase

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
@BeforeClass
public static void setUpDatabase() throws Exception {
    config = new Config() {

        final Dialect dialect = new H2Dialect();

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

        @Override
        public DataSource getDataSource() {
            return database.getDataSource();
        }
    };
}
 
开发者ID:backpaper0,项目名称:sealion,代码行数:18,代码来源:EntityTest.java

示例3: config1

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
@Bean
@Foo
Config config1() {
    return new Config() {

        @Override
        public String getDataSourceName() {
            return "foo";
        }

        @Override
        public Dialect getDialect() {
            return new StandardDialect();
        }

        @Override
        public DataSource getDataSource() {
            return new SimpleDataSource();
        }
    };
}
 
开发者ID:backpaper0,项目名称:spring-boot-doma-multi-config-sample,代码行数:22,代码来源:Application.java

示例4: config2

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
@Bean
@Bar
Config config2() {
    return new Config() {

        @Override
        public String getDataSourceName() {
            return "bar";
        }

        @Override
        public Dialect getDialect() {
            return new StandardDialect();
        }

        @Override
        public DataSource getDataSource() {
            return new SimpleDataSource();
        }
    };
}
 
开发者ID:backpaper0,项目名称:spring-boot-doma-multi-config-sample,代码行数:22,代码来源:Application.java

示例5: testGetEntityListener

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
public void testGetEntityListener() throws Exception {
    Config originalConfig = new MockConfig() {

        @Override
        public EntityListenerProvider getEntityListenerProvider() {
            return new EntityListenerProvider() {
            };
        }
    };

    RuntimeConfig runtimeConfig = new RuntimeConfig(originalConfig);

    MockEntityListener entityListener = runtimeConfig
            .getEntityListenerProvider().get(MockEntityListener.class,
                    MockEntityListener::new);
    assertNotNull(entityListener);
}
 
开发者ID:domaframework,项目名称:doma,代码行数:18,代码来源:RuntimeConfigTest.java

示例6: prepareStatement

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
protected PreparedStatement prepareStatement(Connection connection,
        PreparedSql sql) {
    if (query.isAutoGeneratedKeysSupported()) {
        Config config = query.getConfig();
        Dialect dialect = config.getDialect();
        switch (dialect.getAutoGeneratedKeysType()) {
        case FIRST_COLUMN:
            return JdbcUtil
                    .prepareStatementForAutoGeneratedKeysOfFirstColumn(
                            connection, sql);
        case DEFAULT:
            return JdbcUtil.prepareStatementForAutoGeneratedKeys(connection,
                    sql);
        }
    }
    return JdbcUtil.prepareStatement(connection, sql);
}
 
开发者ID:domaframework,项目名称:doma,代码行数:18,代码来源:BatchModifyCommand.java

示例7: AbstractDao

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
/**
 * 実行時用の設定を作成します。
 * 
 * @param config
 *            JDBCの設定
 * @throws DomaNullPointerException
 *             {@code config} が {@code null} の場合
 * @throws ConfigException
 *             {@code config} の メソッドのどれかが {@code null} を返す場合
 */
protected AbstractDao(Config config, Connection connection) {
    if (config == null) {
        throw new DomaNullPointerException("config");
    }
    if (connection == null) {
        throw new DomaNullPointerException("connection");
    }
    DataSource dataSource = null;
    if (connection instanceof NeverClosedConnection) {
        dataSource = new NeverClosedConnectionProvider(
                (NeverClosedConnection) connection);
    } else {
        dataSource = new NeverClosedConnectionProvider(
                new NeverClosedConnection(connection));
    }
    validateConfig(config, dataSource);
    this.__config = new RuntimeConfig(config, dataSource);
}
 
开发者ID:domaframework,项目名称:doma,代码行数:29,代码来源:AbstractDao.java

示例8: config

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
@Bean
public Config config() {
    return new Config() {

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

        @Override
        public DataSource getDataSource() {
            return dataSource();
        }

        @Override
        public SqlFileRepository getSqlFileRepository() {
            return sqlFileRepository();
        }
    };
}
 
开发者ID:deffence1776,项目名称:Spring-boot-doma-multPj,代码行数:21,代码来源:DataSourceConfiguration.java

示例9: validateMethod

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
protected void validateMethod(TypeElement typeElement, String methodName) {
    Optional<ExecutableElement> method = ElementFilter
            .methodsIn(typeElement.getEnclosedElements())
            .stream()
            .filter(m -> m.getModifiers().containsAll(
                    EnumSet.of(Modifier.STATIC, Modifier.PUBLIC)))
            .filter(m -> TypeMirrorUtil.isAssignable(m.getReturnType(),
                    Config.class, processingEnv))
            .filter(m -> m.getParameters().isEmpty())
            .filter(m -> m.getSimpleName().toString().equals(methodName))
            .findAny();
    if (!method.isPresent()) {
        throw new AptException(Message.DOMA4254, processingEnv,
                typeElement, new Object[] { methodName,
                        typeElement.getQualifiedName() });
    }
}
 
开发者ID:domaframework,项目名称:doma,代码行数:18,代码来源:SingletonConfigProcessor.java

示例10: selectByPassword

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
default User selectByPassword(String account, String password) {
    return selectOptionallyByAccount(account)
            .filter(user -> {
            Config config = Config.get(this);
            SelectBuilder builder = SelectBuilder.newInstance(config);
            PasswordCredential credential = builder.sql("SELECT * ")
                    .sql("FROM password_credentials ")
                    .sql("WHERE user_id = ").param(Long.class, user.getId())
                    .getEntitySingleResult(PasswordCredential.class);
            return (credential != null && Arrays.equals(
                    credential.getPassword(),
                    PasswordUtils.pbkdf2(password, credential.getSalt(), 100)));
    }).orElse(null);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:15,代码来源:UserDao.java

示例11: isLock

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
default boolean isLock(String account) {
    Config config = Config.get(this);
    SelectBuilder builder = SelectBuilder.newInstance(config);
    int cnt = builder.sql("SELECT count(*) FROM user_locks UL")
            .sql(" JOIN users U ON U.user_id = UL.user_id")
            .sql(" WHERE")
            .sql(" account = ").param(String.class, account)
            .getScalarSingleResult(int.class);
    return cnt > 0;
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:11,代码来源:UserDao.java

示例12: showConfig

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
private static void showConfig(Config config) throws Exception {
    System.out.println(config);
    System.out.println(config.getDialect());
    System.out.println(config.getSqlFileRepository());
    System.out.println(config.getNaming());

    DataSource dataSource = config.getDataSource();
    try (Connection con = dataSource.getConnection();
            PreparedStatement pst = con.prepareStatement("select database()");
            ResultSet rs = pst.executeQuery()) {
        rs.next();
        System.out.println(rs.getString(1));
    }
}
 
开发者ID:backpaper0,项目名称:spring-boot-sandbox,代码行数:15,代码来源:SampleApplication.java

示例13: config

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
@Bean
@Primary
Config config(final EntityListenerProvider entityListenerProvider) {
    final DomaConfigBuilder builder = domaProperties()
            .initializeDomaConfigBuilder()
            .dataSource(dataSource())
            .entityListenerProvider(entityListenerProvider);
    return builder.build(domaProperties());
}
 
开发者ID:backpaper0,项目名称:spring-boot-sandbox,代码行数:10,代码来源:PrimaryConfiguration.java

示例14: secondaryConfig

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
@Bean
@Secondary
Config secondaryConfig(final EntityListenerProvider entityListenerProvider) {
    final DomaConfigBuilder builder = secondaryDomaProperties()
            .initializeDomaConfigBuilder()
            .dataSource(secondaryDataSource())
            .entityListenerProvider(entityListenerProvider);
    return builder.build(secondaryDomaProperties());
}
 
开发者ID:backpaper0,项目名称:spring-boot-sandbox,代码行数:10,代码来源:SecondaryConfiguration.java

示例15: index

import org.seasar.doma.jdbc.Config; //导入依赖的package包/类
@RequestMapping(value = "/", produces = "text/plain")
String index() {
    StringWriter s = new StringWriter();
    try (PrintWriter out = new PrintWriter(s)) {
        out.println(Config.get(fooDao).getDataSourceName());
        out.println(Config.get(barDao).getDataSourceName());
    }
    return s.toString();
}
 
开发者ID:backpaper0,项目名称:spring-boot-doma-multi-config-sample,代码行数:10,代码来源:SampleController.java


注:本文中的org.seasar.doma.jdbc.Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。