本文整理汇总了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());
}
}
示例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());
}
}
示例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());
}
}
示例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;
}
示例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();
}
示例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();
}