db4o is an open source embeddable object database for Java and .NET.
As of October 2014 Versant has discontinued the work on db4o due to a decision by Actian, which is the new owner of Versant.
db4o is an simple to use yet powerful object database. It is designed for embedded scenarios and runs on the Java and .NET platform.
You just drop db4o's single programming library (.jar /.dll) into your development environment, open a database file and store any object - no matter how complex - with just one line of code, e.g., in Java:
public void store(Car car) {
ObjectContainer db = Db4oEmbedded.openFile("car.yap");
db.store(car);
db.close();
}
This unmatched ease-of-use results in drastically reduced development time.
Rather than using string-based APIs (such as SQL, OQL, JDOQL, JPAQL, and SODA), Native Queries allow developers to simply use the programming language itself (e.g., Java, C#, or VB.NET) to access the database and thus benefiting from compile-time type checking, the full expressive power of OO-languages, and the great convenience of advanced development environments.
For example, compare this Native Query in C# for .NET 3.5:
IList<Student> students =
from Student student in container
where student.Age < 20 && student.Grade == gradeA
select student;
... or in Java:
List<Student> students = database.query<Student>(new Predicate<Student>() {
public boolean match(Student student) {
return student.getAge() < 20 && student.getGrade().equals(gradeA);
}
});
As you can see, Native Queries eliminate all strings from queries – they are 100% type-safe, 100% refactorable, and 100% object-oriented.
The same concept applies to our LINQ provider which allows you to smoothly move between Relational db and db4o, for a truly complimentary combination. db4o allows using all the constructs of Microsoft’s Language Integrated Queries (LINQ). db4o LINQ syntax is provided for .NET developers and aimed to make writing db4o code even more native and effortless.
Queries like this:
IEnumerable<Pilot> result =
from Pilot p in container
where p.Name.StartsWith("Michael") && p.Points > 2
select p;
…are perfectly valid within db4o.
Another way to load objects from the database is to use the lazy transparent activation pattern. Suppose you already have the object 'c' of type Car; then you can get the pilote like this:
Pilot p = c.getPilot();
…all Pilote attribute are by db4o as you need them.
Resources: