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


Java EntityDataStore类代码示例

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


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

示例1: provideDatabaseSource

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Singleton
@Provides
public EntityDataStore<Persistable> provideDatabaseSource() {
    Observable.<Void>just(null).observeOn(Schedulers.io()).subscribe(new Action1<Void>() {
        @Override
        public void call(Void aVoid) {
            raw2data(app, DB_NAME, R.raw.books);
        }
    });

    DatabaseSource source = new DatabaseSource(app, Models.DEFAULT, DB_NAME, DB_VERSION);
    source.setLoggingEnabled(BuildConfig.DEBUG);
    Configuration configuration = source.getConfiguration();

    return new EntityDataStore<>(configuration);
}
 
开发者ID:xdtianyu,项目名称:Kindle,代码行数:17,代码来源:AppModule.java

示例2: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = Models.MODEL2;

    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EmptyEntityCache())
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = new EntityDataStore<>(configuration);
}
 
开发者ID:requery,项目名称:requery,代码行数:17,代码来源:TimeConversionsTest.java

示例3: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(new H2());
    EntityModel model = Models.JPA;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();
    data = new EntityDataStore<>(configuration);
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.dropTables();
    TableCreationMode mode = TableCreationMode.CREATE;
    System.out.println(tables.createTablesString(mode));
    tables.createTables(mode);
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:JPAModelTest.java

示例4: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = Models.MODEL3;

    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EmptyEntityCache())
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    System.out.println(tables.createTablesString(TableCreationMode.DROP_CREATE));
    data = new EntityDataStore<>(configuration);
}
 
开发者ID:requery,项目名称:requery,代码行数:17,代码来源:UpsertTest.java

示例5: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = new ReactorEntityStore<>(new EntityDataStore<Persistable>(configuration));
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:ReactorTest.java

示例6: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = Models.STATELESS;

    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EmptyEntityCache())
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    System.out.println(tables.createTablesString(TableCreationMode.DROP_CREATE));
    data = new EntityDataStore<>(configuration);
}
 
开发者ID:requery,项目名称:requery,代码行数:17,代码来源:StatelessTest.java

示例7: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(new SQLite());
    EntityModel model = Models.AUTOVALUE;
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .build())
        .build();
    data = new EntityDataStore<>(configuration);
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.dropTables();
    TableCreationMode mode = TableCreationMode.CREATE_NOT_EXISTS;
    System.out.println(tables.createTablesString(mode));
    tables.createTables(mode);
}
 
开发者ID:requery,项目名称:requery,代码行数:18,代码来源:AutoValueModelTest.java

示例8: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Setup
public void setup() {
    EntityModel model = Models.DEFAULT;
    dataSource = (DataSource) DatabaseType.getDataSource(platform);
    data = new EntityDataStore<>(dataSource, model);
    new SchemaModifier(dataSource, model).createTables(TableCreationMode.DROP_CREATE);
    final int count = 10000;
    data.runInTransaction(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            for (int i = 0; i < count; i++) {
                Person person = FunctionalTest.randomPerson();
                data.insert(person);
            }
            return null;
        }
    });
}
 
开发者ID:requery,项目名称:requery,代码行数:19,代码来源:BenchmarkTest.java

示例9: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = ReactiveSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:ReactiveTest.java

示例10: setup

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = RxSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:RxTest.java

示例11: reactiveStore

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void reactiveStore() throws Exception {
  new MockUnit(Env.class, Config.class, Binder.class, EntityModel.class, Registry.class)
      .expect(newDataSource(true))
      .expect(keys)
      .expect(zeroModels).expect(noSchema)
      .expect(store(ReactiveEntityStore.class, "DEFAULT"))
      .expect(onStart)
      .expect(configurationBuilder)
      .expect(eds)
      .expect(unit -> {
        unit.mockStatic(ReactiveSupport.class);
        expect(ReactiveSupport.toReactiveStore(unit.get(EntityDataStore.class)))
            .andReturn(null);
      })
      .run(unit -> {
        Requery.reactive(unit.get(EntityModel.class))
            .configure(unit.get(Env.class), unit.get(Config.class), unit.get(Binder.class));
      }, unit -> {
        unit.captured(Throwing.Consumer.class).iterator().next()
            .accept(unit.get(Registry.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:25,代码来源:RequeryTest.java

示例12: reactorStore

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void reactorStore() throws Exception {
  new MockUnit(Env.class, Config.class, Binder.class, EntityModel.class, Registry.class)
      .expect(newDataSource(true))
      .expect(keys)
      .expect(zeroModels)
      .expect(noSchema)
      .expect(store(ReactorEntityStore.class, "DEFAULT"))
      .expect(onStart)
      .expect(configurationBuilder)
      .expect(eds)
      .expect(unit -> {
        unit.constructor(ReactorEntityStore.class)
            .build(unit.get(EntityDataStore.class));
      })
      .run(unit -> {
        Requery.reactor(unit.get(EntityModel.class))
            .configure(unit.get(Env.class), unit.get(Config.class), unit.get(Binder.class));
      }, unit -> {
        unit.captured(Throwing.Consumer.class).iterator().next()
            .accept(unit.get(Registry.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:25,代码来源:RequeryTest.java

示例13: completableEntityStore

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void completableEntityStore() throws Exception {
  new MockUnit(Env.class, Config.class, Binder.class, EntityModel.class, Registry.class)
      .expect(newDataSource(true))
      .expect(keys)
      .expect(zeroModels).expect(noSchema)
      .expect(store(CompletionStageEntityStore.class, "DEFAULT"))
      .expect(onStart)
      .expect(configurationBuilder)
      .expect(eds)
      .expect(unit -> {
        unit.constructor(CompletableEntityStore.class)
            .build(unit.get(EntityDataStore.class));
      })
      .run(unit -> {
        Requery.completionStage(unit.get(EntityModel.class))
            .configure(unit.get(Env.class), unit.get(Config.class), unit.get(Binder.class));
      }, unit -> {
        unit.captured(Throwing.Consumer.class).iterator().next()
            .accept(unit.get(Registry.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:24,代码来源:RequeryTest.java

示例14: getData

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
@NonNull
public ReactiveEntityStore<Persistable> getData() throws RuntimeException {
    if (dataStore == null) {
        // override onUpgrade to handle migrating to a new version
        DatabaseSource source = new DatabaseSource(getReflectedContext(), Models.DEFAULT, 1);
        if (BuildConfig.DEBUG) {
            // use this in development mode to drop and recreate the tables on every upgrade
            source.setTableCreationMode(TableCreationMode.DROP_CREATE);
        }
        Configuration configuration = source.getConfiguration();
        dataStore = ReactiveSupport.toReactiveStore(
                new EntityDataStore<Persistable>(configuration));
    }
    return dataStore;
}
 
开发者ID:kbiakov,项目名称:newsreader-mvp-android,代码行数:16,代码来源:DbManager.java

示例15: getDataStore

import io.requery.sql.EntityDataStore; //导入依赖的package包/类
public static EntityDataStore<Persistable> getDataStore(DatabaseSource source) {
    Configuration configuration = new ConfigurationBuilder(source, Models.DEFAULT)
            .setMapping(new MainMapping())
            .setStatementCacheSize(100)
            .setEntityCache(new EntityCacheBuilder(Models.DEFAULT)
                    .useReferenceCache(true)
                    .build())
            .build();
    return new EntityDataStore<>(configuration);
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:11,代码来源:SqlHelper.java


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