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
3
votes
1 answer

DB4O recursive deleting, how it actually works?

I'm a little bit stuck with my db4o homework and I don't really know how to solve this. The case is that I have a simple school student/credit/course database. Objects have following…
zaplec
  • 1,681
  • 4
  • 23
  • 51
3
votes
1 answer

Unit Testing Db4oTool Instrumentation (Collections)

I am using the db4oTool to instrument my classes for transparent activation/persistence. I am using the -ta and -collections switches. I know how to check that the classes themselves are being properly instrumented by the following…
Travis
  • 241
  • 1
  • 10
3
votes
2 answers

db4o on Android 3.0+ Issue

I'm having an issue with db4o on Android 3.0+ because it turns out that on the creation of the db4o database, it uses some of the network apis by default. (I stumbled upon this post:…
Hosemeyer
  • 1,264
  • 4
  • 17
  • 29
3
votes
2 answers

How to realize persistence of a complex graph with an Object Database?

I have several graphs. The breadth and depth of each graph can vary and will undergo changes and alterations during runtime. See example graph. There is a root node to get a hold on the whole graph (i.e. tree). A node can have several children and…
3
votes
1 answer

Basic db4o issues

I am very very new to db4o, and c# in general, and am having real trouble getting my head around how to start using it - the tutorial provided isn't helping me a lot - I understand the jist of it, but am having trouble understanding where to put…
E Steven
  • 81
  • 9
3
votes
1 answer

xhange classes attributes in existing db4o in android

I'm considering to use db4o in my android project to store objects but my concern is if in the future I want to change one of the objects attributes how do i deal with the existing data of that object in the db4o file? I know in sqlite3 environment…
AdamSharp
  • 55
  • 3
3
votes
1 answer

How does db4o maintain the performance

I have read here (search on the string key "core operates in single-thread mode") that db4o core is inherently single threaded, then how does it maintain performance/throughput when multiple users try to access the database concurrently?
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
3
votes
1 answer

DB4o HashMap toString()

As a learning tool for DB4o and Java I have started to create a Telephone Directory. To do this I create an instance of a TelephoneDirectory which contains a year and a HashMap of entries. public class TelephoneDirectory { private int year; …
Adam Holmes
  • 1,783
  • 3
  • 20
  • 32
3
votes
2 answers

using db4o database with gridview control in asp.net

I have a db4o database which i want to use with asp.net web application and i want to databind data from db4o database. How can i do that ? I'm using VS2008/asp.net with c# Help me out Thanks
user691936
  • 45
  • 5
3
votes
1 answer

Full text search with DB4O

In my DB4O database I have an amount of Book objects Book +string: Title ... When entering a title (string) in my form I would like to suggest existing titles. Currently I use a simple book.Title.Contains(titlePart) But it would be a nice…
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
3
votes
2 answers

db4o concerns

I'm interested in using db4o as my persistence mechanism in my Desktop application but I'm concerned about a couple things. 1st concern: Accidentally clipping very complex object graphs. Say I have a tree with a height of 10 and I fetch the root,…
Allain Lalonde
  • 91,574
  • 70
  • 187
  • 238
3
votes
4 answers

JDO: Is the PersistenceManager a singleton?

Just the basics: I'm using DataNucleus backed with an embedded DB4O database. If I do this simple test: PersistenceManager pm1 = persistenceManagerFactory.getPersistenceManager(); PersistenceManager pm2 =…
David Parks
  • 30,789
  • 47
  • 185
  • 328
3
votes
1 answer

How do you change the schema in an OO database such as DB4O?

Just getting started with DB4O object oriented database. I'm very familiar with SQL, if I upgrade the app and add a new field I just go into a SQL manager, change the schema, and initialize a new field with some manual SQL. What is the process with…
David Parks
  • 30,789
  • 47
  • 185
  • 328
3
votes
1 answer

db4o, how to update an object if a field was added?

How can I do this? I stored an object in db4o, e.g: class Person { string _name; int _age; } now, after hundrets of Persons stored in the db, I've added a new field: class Person { string _name; int _age; bool?…
chriszero
  • 1,311
  • 3
  • 13
  • 26
3
votes
1 answer

Lift with db4o User model

suppose you have a Lift + db4o project... How do you define User model? Should I extend MetaMegaProtoUser? Thanks in advance, Etam.
Etam
  • 4,553
  • 10
  • 40
  • 60
1 2
3
25 26