{@code StoreConfig} objects are thread-safe. Multiple threads may safelycall the methods of a shared {@code StoreConfig} object.
See the {@link package summary example} for an example of using a {@code StoreConfig}.
636465666768697071
} private void open() throws DatabaseException { StoreConfig config = new StoreConfig(); config.setAllowCreate(envConfig.getAllowCreate()); open(config); }
658659660661662663664665666667668669670
open(); store.getPrimaryIndex(Integer.class, MyEntity.class); close(); StoreConfig config = new StoreConfig(); config.setReadOnly(true); config.setTransactional(envConfig.getTransactional()); RawStore rawStore = new RawStore(env, "test", config); String clsName = MyEntity.class.getName(); rawStore.getSecondaryIndex(clsName, "secKey");
822823824825826827828829830831832833834
PrimaryIndex<Integer,RelatedX> priX; PrimaryIndex<Integer,RelatedY> priY; SecondaryIndex<Integer,Integer,RelatedX> secX; /* Open priX with SecondaryBulkLoad=true. */ StoreConfig config = new StoreConfig(); config.setAllowCreate(true); config.setSecondaryBulkLoad(true); open(config); /* Getting priX should not create the secondary index. */ priX = store.getPrimaryIndex(Integer.class, RelatedX.class); PersistTestUtils.assertDbExists
158159160161162163164165166167168169170
envConfig.setInitializeCache(true); envConfig.setInitializeLocking(true); env = new Environment(envHome, envConfig); /* Open a transactional entity store. */ StoreConfig storeConfig = new StoreConfig(); storeConfig.setAllowCreate(true); storeConfig.setTransactional(true); store = new EntityStore(env, "PersonStore", storeConfig); /* Initialize the data access object. */ dao = new PersonAccessor(store); }
80818283848586878889909192
// performed the least amount of write activity to // receive the deadlock notification, if any. myEnvConfig.setLockDetectMode(LockDetectMode.MINWRITE); // Set up the entity store StoreConfig myStoreConfig = new StoreConfig(); myStoreConfig.setAllowCreate(true); myStoreConfig.setTransactional(true); // Need a DatabaseConfig object so as to set uncommitted read // support. DatabaseConfig myDbConfig = new DatabaseConfig(); myDbConfig.setType(DatabaseType.BTREE);
77787980818283848586878889
* Opens the store. */ private void open() throws DatabaseException { StoreConfig config = new StoreConfig(); config.setAllowCreate(envConfig.getAllowCreate()); config.setTransactional(envConfig.getTransactional()); store = new EntityStore(env, "test", config); primary = store.getPrimaryIndex(Integer.class, MyEntity.class); oneToOne =
88899091929394959697
envConfig.setInitializeCache(true); envConfig.setInitializeLocking(true); env = new Environment(envHome, envConfig); /* Open a transactional entity store. */ StoreConfig storeConfig = new StoreConfig(); storeConfig.setAllowCreate(true); storeConfig.setTransactional(true); store = new EntityStore(env, "TestStore", storeConfig); }
163164165166167168169170171172173174175
private void init() throws DatabaseException { /* Open a transactional entity store. */ System.out.println("-> Creating a BDB database"); StoreConfig storeConfig = new StoreConfig(); storeConfig.setAllowCreate(true); storeConfig.setTransactional(true); store = new EntityStore(env, "ExampleStore", storeConfig); eventByTime = store.getPrimaryIndex(Date.class, Event.class); eventByPrice = store.getSecondaryIndex(eventByTime, Integer.class,
117118119120121122123124125126127128
} private void dump() throws DatabaseException { StoreConfig storeConfig = new StoreConfig(); storeConfig.setReadOnly(true); RawStore store = new RawStore(env, storeName, storeConfig); EntityModel model = store.getModel(); for (String clsName : model.getKnownClasses()) { EntityMetadata meta = model.getEntityMetadata(clsName);
666768697071727374757677
EnvironmentConfig envConfig = TestEnv.BDB.getConfig(); envConfig.setAllowCreate(true); env = new Environment(envHome, envConfig); StoreConfig storeConfig = new StoreConfig(); storeConfig.setAllowCreate(true); EntityStore store = new EntityStore(env, "foo", storeConfig); PrimaryIndex<String, Employee> employeesById = store.getPrimaryIndex(String.class, Employee.class);