I find it useful when experimenting with various data providers and comparing benchmarks results.
Below you can see example of its usage to feel the flavor of this API.
// Define entity class
case class SampleEntity(id: String) extends Entity[String] {
entityId = Some(id)
}
// create DB4O entity store
val objectContainer = Db4oEmbedded.openFile("/tmp/db")
val entityStore = new Db4oEntityStore(objectContainer)
// Store entity
entityStore.store(new SampleEntity("id"))
// Find entity
val query: Predicate[SampleEntity] = (entity: SampleEntity) => entity.getEntityId() == Some("id")
val results = store.query[SampleEntity](query)
No comments:
Post a Comment