Questions tagged [db4o]

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:

380 questions
1
vote
2 answers

Method to do a "join" when using LINQ in db4o?

Whats the correct LINQ to navigate to the end leaf node of the following data structure? Root ----Symbol (APPLE) | |------Day 1: Date: 2010-10-18, string "Apples on Thursday" | |------Day 2: Date: 2010-10-19,…
Contango
  • 76,540
  • 58
  • 260
  • 305
1
vote
3 answers

unsupported class hierarchy change in Db4o

I have: static class Db4o... and: class Db4oBase... // which uses Db4o class where I can: class Customer : Db4oBase { public Customer(string name) { } } so that I can: Customer customer = new Customer("Acbel Polytech…
LEMUEL ADANE
  • 8,336
  • 16
  • 58
  • 72
1
vote
1 answer

How can I configure the indexes for using db4o with Spring?

I'm currently evaluating the Spring-db4o integration. I was impressed by the declarative transaction support as well as the ease to provide declarative configuration. Unfortunately, I'm struggling to figure how to create an index on specific fields.…
Shamik
  • 1,671
  • 11
  • 36
  • 64
1
vote
2 answers

Do I have to re-apply db4o configuration settings (and indexes) on each application run, or only on database creation?

I'm in the process of evaluating db4o and I have a pretty simple question. Does the db4o configuration settings (e.g. Transparent Activation) and indexes need to be setup each time the application runs and/or the database is loaded, or can all this…
Jason L.
  • 2,464
  • 1
  • 23
  • 41
1
vote
2 answers

Why can't I use the same db4o file from multiple connections?

I'm just connecting to a db4o database file from 2 different connections with the LockDatabaseFile=false configuration value. When I store an object from an IObjectContainer, I'm unable to get that object from the other IObjectContainer at the same…
1
vote
1 answer

DB4O: limit a query by range

Is it possible to get a query result by a interval? I was think something like that: List getRangeQuery(Object example, int beginIndex, int endIndex){ ObjectSet set = db.queryByExample(example); return set.subList(beginIndex,…
1
vote
3 answers

db4o vs sql, sqlite in java server

Im creating a java web server for storing JSON strings with location data (latitude, longitude and time) I wondering if there are any advantages(performance, scalability, maintenance, etc) for using db4o which seems easier to use in java instead of…
Mauricio Galindo
  • 638
  • 1
  • 10
  • 16
1
vote
1 answer

Storing TimeSpan in db4o

I know that TimeSpan's are immutable. I have a object which contains a TimeSpan field. This field is updated frequently. Every time I update the object in the db, db4o updates the TimeSpan field. So far, so good. But the old TimeSpan structs are…
chriszero
  • 1,311
  • 3
  • 13
  • 26
1
vote
2 answers

Scala Set implementation to use within business model?

Let's say we want to build a big social network (because social networks are all the rage at the moment). We'll start with a simple premise that anyone who wants to use our social network should be able to register under their name and then become…
Vlad Gudim
  • 23,397
  • 16
  • 69
  • 92
1
vote
1 answer

Is there a tool to monitor the latest version of db4o?

I have tried the Object Manager and the Boo browser, but none of these work with the latest DB4O file format.
yazz.com
  • 57,320
  • 66
  • 234
  • 385
1
vote
0 answers

Testing android project with db4o (or other referenced lib)

I'm working on a project for android that uses an external library, db4o. Well, I've created a test project and I was trying to test my PersistenceManager, an object that controls the database life-cycle and exposes part of the ObjectContainer api…
1
vote
1 answer

Db4o, Java: Storing images using blobs

I want to store images in Db4o using Blobs. How can I store them and how do I get them out again?
AntonS
  • 700
  • 1
  • 6
  • 23
1
vote
2 answers

db4o - ignore specific class property

Is there a way (meta property maybe) to tell db4o to simply ignore a specific property of a class? I can't see anywhere to do that.. For my purpose I have a bunch of data entity that i need to persist now and then. I also sometimes need to hold a…
Ben
  • 20,737
  • 12
  • 71
  • 115
1
vote
1 answer

DatabaseFileLockedException driving me crazy

I am following the example here: http://developer.db4o.com/Forums/tabid/98/aft/10114/Default.aspx to setup my MVC2 app with db4o using an HttpModule. I also have a LINQPad instance open to query the data as I develop. The web app seems to work…
Matthew Groves
  • 25,181
  • 9
  • 71
  • 121
1
vote
0 answers

Add db4o database to monodevelop in linux

I would like to include db4o jar files into monodevelop ide on Linux, I have researched a lot and I am not able to find anything that could help, could anyone help me with this issue or suggest me an ide where I could develop .net application with…
Natto
  • 213
  • 1
  • 4
  • 17