use of io.requery.sql.ConfigurationBuilder in project requery by requery.
the class UpsertTest method setup.
@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);
}
use of io.requery.sql.ConfigurationBuilder in project requery by requery.
the class SchemaModifierTest method setup.
@Before
public void setup() throws SQLException {
CommonDataSource dataSource = DatabaseType.getDataSource(platform);
EntityModel model = io.requery.test.model.Models.DEFAULT;
Configuration configuration = new ConfigurationBuilder(dataSource, model).useDefaultLogging().setStatementCacheSize(10).setBatchUpdateSize(50).setWriteExecutor(Executors.newSingleThreadExecutor()).build();
schemaModifier = new SchemaModifier(configuration);
try {
schemaModifier.dropTables();
} catch (Exception e) {
// expected if 'drop if exists' not supported (so ignore in that case)
if (!platform.supportsIfExists()) {
throw e;
}
}
schemaModifier.createTables(TableCreationMode.CREATE);
}
use of io.requery.sql.ConfigurationBuilder in project requery by requery.
the class ReactiveTest method setup.
@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));
}
use of io.requery.sql.ConfigurationBuilder in project requery by requery.
the class DatabaseSource method getConfiguration.
@Override
public Configuration getConfiguration() {
if (mapping == null) {
mapping = onCreateMapping(platform);
}
if (mapping == null) {
throw new IllegalStateException();
}
if (configuration == null) {
ConfigurationBuilder builder = new ConfigurationBuilder(this, model).setMapping(mapping).setPlatform(platform).setBatchUpdateSize(1000);
onConfigure(builder);
configuration = builder.build();
}
return configuration;
}
use of io.requery.sql.ConfigurationBuilder in project requery by requery.
the class SqlCipherDatabaseSource method getConfiguration.
@Override
public Configuration getConfiguration() {
if (configuration == null) {
ConfigurationBuilder builder = new ConfigurationBuilder(this, model).setMapping(mapping).setPlatform(platform).setBatchUpdateSize(1000);
onConfigure(builder);
configuration = builder.build();
}
return configuration;
}
Aggregations