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


Java ServerConfig.addClass方法代码示例

本文整理汇总了Java中com.avaje.ebean.config.ServerConfig.addClass方法的典型用法代码示例。如果您正苦于以下问题:Java ServerConfig.addClass方法的具体用法?Java ServerConfig.addClass怎么用?Java ServerConfig.addClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.avaje.ebean.config.ServerConfig的用法示例。


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

示例1: SQLOfflineTeamHandler

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public SQLOfflineTeamHandler()
{
    ServerConfig config = new ServerConfig();
    config.setDataSourceConfig(MWAPI.getConfig().getDataSourceConfig());
    config.addClass(BasicTeam.class);

    server = EbeanServerFactory.create(config);

    try
    {
        server.find(BasicTeam.class).findRowCount();
    }
    catch (Exception e)
    {
        DdlGenerator gen = ((DefaultServer) server).getDdlGenerator();
        gen.runScript(true, gen.generateCreateDdl());
    }
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:19,代码来源:SQLOfflineTeamHandler.java

示例2: SQLOfflineGameHandler

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public SQLOfflineGameHandler()
{
    ServerConfig config = new ServerConfig();
    config.setDataSourceConfig(MWAPI.getConfig().getDataSourceConfig());
    config.addClass(BasicGame.class);
    config.addClass(MapScalarTypeConverter.class);

    server = EbeanServerFactory.create(config);

    try
    {
        server.find(BasicGame.class).findRowCount();
    }
    catch (Exception e)
    {
        DdlGenerator gen = ((DefaultServer) server).getDdlGenerator();
        gen.runScript(true, gen.generateCreateDdl());
    }
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:20,代码来源:SQLOfflineGameHandler.java

示例3: SQLOfflineUserHandler

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public SQLOfflineUserHandler()
{
    ServerConfig config = new ServerConfig();
    config.setDataSourceConfig(MWAPI.getConfig().getDataSourceConfig());
    config.addClass(BasicUser.class);

    server = EbeanServerFactory.create(config);

    try
    {
        server.find(BasicUser.class).findRowCount();
    }
    catch (Exception e)
    {
        DdlGenerator gen = ((DefaultServer) server).getDdlGenerator();
        gen.runScript(true, gen.generateCreateDdl());
    }
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:19,代码来源:SQLOfflineUserHandler.java

示例4: adaptFrom

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public ServerConfig adaptFrom(SqlDbServiceConfig actConfig, act.db.sql.DataSourceConfig dsConfig,  SqlDbService svc) {
    ServerConfig config = new ServerConfig();

    config.setName(svc.id());
    config.setDataSourceConfig(adaptFrom(dsConfig, svc));

    config.setDdlGenerate(actConfig.ddlGeneratorConfig.create);
    config.setDdlRun(actConfig.ddlGeneratorConfig.create);
    config.setDdlCreateOnly(!actConfig.ddlGeneratorConfig.drop);

    config.setNamingConvention(namingConvention(actConfig));

    Set<Class> modelClasses = svc.modelClasses();
    if (null != modelClasses && !modelClasses.isEmpty()) {
        for (Class modelClass : modelClasses) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(S.concat("add model class into Ebean config: ", modelClass.getName()));
            }
            config.addClass(modelClass);
        }
    }

    return config;
}
 
开发者ID:actframework,项目名称:act-ebean,代码行数:25,代码来源:EbeanConfigAdaptor.java

示例5: InMemoryEbeanServer

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
public InMemoryEbeanServer() {
    // Create in-memory database configuration.
    DataSourceConfig dbConfig = new DataSourceConfig();
    dbConfig.setUsername("sa");
    dbConfig.setPassword("");
    dbConfig.setUrl("jdbc:h2:mem:tests2;DB_CLOSE_DELAY=-1");
    dbConfig.setDriver("org.h2.Driver");

    ServerConfig config = new ServerConfig();
    config.setName("h2");
    config.setDataSourceConfig(dbConfig);
    config.setDefaultServer(true);

    for (Class<?> entity : EbeanEntities.getEntities()) {
        config.addClass(entity);
    }

    config.setDdlGenerate(true);
    config.setDdlRun(true);

    server = EbeanServerFactory.create(config);
    ddl = ((SpiEbeanServer) server).getDdlGenerator();
}
 
开发者ID:Lugribossk,项目名称:dropwizard-experiment,代码行数:24,代码来源:InMemoryEbeanServer.java

示例6: findAsOf_given_intersectionWithNoHistory_then_joinNormalAndNoEffectiveDatePredicate

import com.avaje.ebean.config.ServerConfig; //导入方法依赖的package包/类
@Test
public void findAsOf_given_intersectionWithNoHistory_then_joinNormalAndNoEffectiveDatePredicate() {

  ServerConfig serverConfig = new ServerConfig();
  serverConfig.setName("pg");
  serverConfig.setDefaultServer(true);
  serverConfig.loadFromProperties();
  serverConfig.addClass(CustomerExcludeM2M.class);
  serverConfig.addClass(FeatureExcludeM2M.class);
  serverConfig.addClass(ContactExcludeM2M.class);
  serverConfig.addClass(Address.class);
  serverConfig.addClass(Country.class);

  EbeanServer localServer = EbeanServerFactory.create(serverConfig);

  long epochMilli = OffsetDateTime.now().minusHours(3).toInstant().toEpochMilli();
  Timestamp asOf = new Timestamp(epochMilli);

  LoggedSql.start();

  localServer.find(CustomerExcludeM2M.class)
      .asOf(asOf)
      .fetch("features")
      .where().eq("name", "jack")
      .findUnique();

  List<String> loggedSql = LoggedSql.stop();
  assertThat(loggedSql).hasSize(1);

  String sqlSelect = loggedSql.get(0);

  assertThat(sqlSelect.contains(" --bind(jack asOf ")).isTrue();
  assertThat(sqlSelect.contains(" from customer_with_history t0 ")).isTrue();
  assertThat(sqlSelect.contains(" join customer_feature t1z_ ")).isTrue();
  assertThat(sqlSelect.contains(" t0.sys_period @> ?::timestamptz")).isTrue();
  assertThat(!sqlSelect.contains(" t1z_.sys_period @> ?::timestamptz")).isTrue();

}
 
开发者ID:ebean-orm-examples,项目名称:avaje-ebeanorm-examples,代码行数:39,代码来源:CustomerFindWithManyToMany.java


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