db4o open source object database
db4o :: Product News Blog

Syndicate This

Tuesday, November 15, 2005

db4o 5.0 production release

The db4objects team is proud to announce the release of db4o 5.0 to production with a great innovation: Native Queries.

The benefits of using Native Queries:

- 100% compile time checked
Since all query code is written in your programming language (not in strings) all syntax errors will be detected by the compiler.

- 100% object-oriented
Native Queries allow you to use the full power of your programming language in queries. All constructs are legal: method calls, local variables, overriding, overloading. You can operate against the public facade of your classes (getters, properties) or against the private implementation (fields), as you like.

- 100% refactorable
Since queries are now an integral part of your application, you can refactor all queries automatically with your development environment.

- More Productive
Your IDE will help you to write Native Query expressions by providing autocompletion.

- Fast
Under the hood db4o analyzes native query bytecode / IL code and converts it to run against database indexes.


You are invited to evaluate Native Queries against your requirements and experience the benefits.

Here is another Native Query example as an appetizer. It demonstrates two features:
(1) Queries allow multiple exit points. I use a guard pattern here.
(2) You can use local mutable variables in a query.


C#
-------

IList <Product> products = db.Query <Product>(delegate(Product product){
if (product.License == Licenses.GPL){
return true;
}
float price = product.Price;
Vendor vendor = product.Vendor;
return price > 10
&& price < 100
&& vendor.Name.StartsWith("d")
&& vendor.Country == Countries.USA;
});


Java
-------
List <Product> products = db.query(new Predicate <Product>(){
public boolean match(Product product){
if(product.getLicense() == Licenses.GPL){
return true;
}
Float price = product.getPrice();
Vendor vendor = product.getVendor();
return price > 10
&& price < 100
&& vendor.getName().startsWith("d")
&& vendor.getCountry() == Countries.USA;
}
});



When you write Native Queries, don't forget that your IDE is very likely to provide features to fully automate all the typing work of generating the enclosing frame of a Native Query for you. In Eclipse you could set up a code template. In VS.NET a Macro can do the job just as good.


Additional noteworthy features in the 5.0 release:

- The index processor has taken a big peformance step forward for ranges.
- db4o uses a new freespace management system by default, based on the internal indexing algorithm. Index-based freespace management may be somewhat slower than the old RAM-based-system, but it guarantees ACID behaviour on systems that are frequently turned off (handhelds). If you want to use the old system, you can of course configure db4o to use it by calling Db4o.configure().freespace().useRamSystem().


Further notes:

- We know that there are still issues with persisting .NET 2.0 generic collections, we are currently solving them.
- We did not manage to include optimized Native Queries with 2.0 delegate syntax for CompactFramework 2.0. We will soon provide a patch with a solution.
- Mono is slightly lagging behind our other releases. We are in contact with the Mono team to solve the remaining problems.
- The .NET 2.0 version is compiled against the .NET framework that comes with VS.NET 2005 final. You can easily compile the sources yourself, if you want to work with earlier .NET framework versions.