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

prevent same object return in the same time in db4o

i am using db4o in a asp.net web application, as you know when db4o returns a list of objects they are not ordered. in my website, i run a query and get the last object in the results and work on it (some processing and then update one of its…
iBoy
  • 423
  • 3
  • 9
1
vote
0 answers

db4o field indexed, but not used in queries

I have a simple object with a Guid as field public Guid _id, this field is indexed. config.Common.ObjectClass(typeof(ConfigurableObject)) .ObjectField("_id").Indexed(true); When I open the databasefile in the ObjectManager Enterprise, it…
chriszero
  • 1,311
  • 3
  • 13
  • 26
1
vote
1 answer

Scalable freetext & parametric searching (C#)

Currently, we've got an application that needs to perform very fast searches on ~2 mill records. Searches need to search both a large free-text field, and a number of integer/decimal fields between different ranges, along with various…
Dave Bish
  • 19,263
  • 7
  • 46
  • 63
1
vote
1 answer

db4o development tools and resources?

Since the 7.x versions of db4o ObjectManager are only available as a commercial product (very expensive!) are there any alternative tools that are available to inspect/explore db4o 7.x databases? Also, what other tools would you recommend to a…
Mike Moore
  • 1,330
  • 1
  • 14
  • 20
1
vote
1 answer

Is db4o Java 8 compatible?

Have side project that is using db4o. It's doesn't work with JVM 8 (on deserialising getting Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field com.xxx.yyy.version to com.db4o.reflect.generic.GenericObject). Is it…
FoxyBOA
  • 5,788
  • 8
  • 48
  • 82
1
vote
0 answers

IsolatedIsolatedStorageException in WPF application when creating/opening a db4o database?

My code snippet: using (var db = Db4oEmbedded.OpenFile(@"c:\temp\db4o\my.data")) { ... } throws the following exception An exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll but was not handled…
Eduardo Brites
  • 4,597
  • 5
  • 36
  • 51
1
vote
2 answers

Managing Unique IDs in stateless (web) DB4O applications

I'm playing around with building a new web application using DB4O - piles of fun and some really interesting stuff learned. The one thing I'm struggling with is DB4O's current lack of support for stateless applications (i.e. web apps, mostly) and…
Phil.Wheeler
  • 16,748
  • 10
  • 99
  • 155
1
vote
1 answer

How to register for callbacks on a DB4O server?

I have a DB4O server listening on a port IObjectServer server = Db4oClientServer.OpenServer("filename.db40", 11978); How do i register for callbacks? For example how do i execute some custom code before an object is read or stored?
Simon
  • 33,714
  • 21
  • 133
  • 202
1
vote
2 answers

Handling ID's with db4o and ASP.NET MVC2

So, i'm looking at the TekPub sample for ASP.NET MVC2 (http://mvcstarter.codeplex.com/) using DB4o and there are a bunch of templates to create controllers etc, the generated code looks like: public ActionResult Details(int id) { var…
Craig McGuff
  • 3,968
  • 6
  • 30
  • 35
1
vote
1 answer

How to use db4o IObjectContainer in a web application ? (Container lifetime ?)

I am evaluating db4o for persistence for a ASP .NET MVC project. I am wondering how I should use the IObjectContainer in a web context with regards to object lifetime. As I see it, I can do one of the following: Create the IObjectContainer at…
driis
  • 161,458
  • 45
  • 265
  • 341
1
vote
1 answer

How to query for the oldest object from db4o?

I have objects that has a DateTime property, how can i query for the oldest object? After asking on db4o forum, I get the answer: It's quite easy: create a sorted SODA-Query and take the first / last object from the resulting ObjectSet. Don't…
Benny
  • 8,547
  • 9
  • 60
  • 93
1
vote
5 answers

Prevent orphaned objects in DB4O when updating fields

I want to store Person objects in DB4O. The Person Location field can be changed over time. So I retrieve a person from the DB and call a method to set the location field to a new Location object. (I want the Location objects to be immutable i.e.…
Andrew Davey
  • 5,441
  • 3
  • 43
  • 57
1
vote
2 answers

Subsonic and DB4O

I was recently reading Rob Conery's post about DB4O and it was very interesting. My question is really concerned with class generation and future use of Subsonic and DB4O. As Subsonic looks at the database and then generates classes how would this…
Jon
  • 38,814
  • 81
  • 233
  • 382
1
vote
2 answers

db4o object update dilemma

I am new to db4o. I have this question in mind: when the object are retrieved from DAL, maybe it will update in Business layer, then we lost it's original property, so when it comes to updating how can I find which one is the original object in the…
Benny
  • 8,547
  • 9
  • 60
  • 93
1
vote
1 answer

ninject 2 and db4o

I am trying to use ninject with db4o and I have a problem. This is the relevant code from the Global.aspx static IObjectServer _server; protected override void OnApplicationStarted() { AutoMapperConfiguration.Configure(); …
user10479
  • 790
  • 2
  • 9
  • 22