Welcome. db4o is the native Java,.NET and Mono open source object database. This tutorial was written to get you started with db4o as quickly as possible. This documentation and tutorial is intended to get you started with db4o and to be a reliable The db4o object database engine consists of one single jar file. Introduction; Query by Example; Updates and identity; A search utility method; Advanced queries; Native queries in db4o; In conclusion.

Author: Ter Ararn
Country: Kosovo
Language: English (Spanish)
Genre: Finance
Published (Last): 23 September 2013
Pages: 423
PDF File Size: 17.70 Mb
ePub File Size: 10.87 Mb
ISBN: 722-6-63219-931-2
Downloads: 75556
Price: Free* [*Free Regsitration Required]
Uploader: Goltijas

Store new Person “Petra” ; db. By default, db4o will NOT descend into child objects.

Getting Started With db4o

SODA query expressions are a standard that was present in all but the earliest versions of db4o. You can also use the db. Sign in or register to add and subscribe to comments. In the previous example, the query is looking for all Person types where the firstName field is equal to “Brian,” and the lastName and age fields d4o effectively ignored. In this way, programmers can continue to write queries in the language they’re comfortable with, but the query itself can be translated into something the database can understand and execute efficiently.

Native Query results can be sorted by using an IComparer or a comparison delegate. Please also try out the keyword search functionality on the db4o knowledgebase.


Always make sure that the object you are trying to update or delete was previously stored or retrieved in the database. Object data is activated as the users accesses each object in the result set.

db4o tutorial

In db4o, the OID for a given object can be found through a call to db. Setting the ActivationDepth dbo aggressively can cause poor db4o query performance and high memory usage. A non-generics version of the Predicate API is available for versions prior to Java 5, though it isn’t quite as easy to use.

There is one more thing to be aware of: First we create a class to hold our data. An iterator is created against the best index found. A list of object ID matches is generated completely when the query is executed and held in memory.

The second option pollutes the simplicity of the QBE approach and leads to monstrosities like the one shown in Listing It can be assembled again in the morning, but one eventually asks whether this is the most efficient way to park a car. Queries, updates, and identity.

Almost no memory is needed to hold the result set. ObjectContainer represents “The Database”, and will be your primary interface to db4o.

The busy Java developer’s guide to db4o: Queries, updates, and identity

Actually, much of the utility method’s utility become apparent when placed onto the stored class itself, as shown in Listing Especially in a strongly typed language like C or Java programming, these object types have to be known a prioriunlike the set-based notion of SQL. All of an object’s properties and child objects will be stored. Properties of the 5th descendant object will have their values left as default or null.


As always, see the db4o documentation for the complete details of the ExtObjectContainer class. If you are familiar with object-relational mapping Yutorial tools, then you are already an object database expert because many of the APIs and query languages are comparable. You need it to compile the examples.

db4o tutorial – db4objects Inc. – Informatique

To close the transaction, use the Commit method:. But please don’t repeat that name to the db4o developers; you’ll get me in trouble. All Values Object data is activated as the users accesses each object in the result set. NET suffer from the same limitation. It’s eb4o easy to see how any moderately complicated query will rapidly become unworkable using this technique, particularly when compared against the simplicity of a query language like SQL.