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

Griffon db4o plugin configuration

I'd like to use db4o inside Griffon app, but I've problem with configuration: how to set up plugin to not delete dbFile during AppShutdown. There is some info about configuration at plugin page: def configure(EmbeddedConfiguration configuration)…
pankonrad
  • 11
  • 1
1
vote
1 answer

How to efficiently retrieve every Nth object from DB4O ordered on an indexed field

I store a lot of events in a DB4O db. The events are timestamped and I've indexed the field. Retrieving (an enumerator of) all events, ordered by timestamp, takes almost no time at all (as they aren't activated). However, what if I only want to…
Micke
  • 2,251
  • 5
  • 33
  • 48
1
vote
1 answer

Using DB4O in MVVM application with Prism

I would like to use db4o for persisting my business object in Prism aplication. How should I maintain IObjectContainer lifetime? As I know from documentation, when I load object with one container I should save it with the same one. So maybe some…
Lukas Pirkl
  • 1,417
  • 3
  • 15
  • 31
1
vote
0 answers

Java is not able to access my enum attribute

I need to store a restaurant in a object oriented database with a name and a list of employees and products so when I create one of the latter I need a name an enum (3 categories) and a price. Exception in thread "main"…
Ivan
  • 21
  • 4
1
vote
1 answer

Deleting Child Entities in JDO

I would like to know if the following is possible in JDO. I have a 1-N relationship between a Parent and a Child class. So my classes look like @PersistenceCapable public class Parent { @Persistent private String name; …
Don'tWantTo
  • 155
  • 3
  • 8
1
vote
2 answers

groovy domain objects in Db4O database

I'm using db4o with groovy (actually griffon). I'm saving dozen of objects into db4o objectSet and see that .yarv file size is about 11Mb. I've checked its content and found that it stores metaClass with all nested fields into every object. It's a…
Archer
  • 5,073
  • 8
  • 50
  • 96
1
vote
2 answers

hierarchical nested data structure in db4o (or any other oodb)

Really my question is, if I were to use a nested data structure in oodb would I be placing instance of classes within other instances in the db, or is there some sort of relational mapping that would be required. I've been interested in OODB (Object…
BizNuge
  • 938
  • 1
  • 8
  • 20
1
vote
1 answer

Db4o is extremely slow in Eclipse debug mode

I'm working with a db4o database and have a database of approximately 1000-5000 objects on Mac OS X, developing in Eclipse Helios. Currently, I'm retrieving all objects of a certain class: ObjectSet query = m_container.query(Task.class); But…
Patrick
  • 4,720
  • 4
  • 41
  • 71
1
vote
2 answers

Retrieve an object in one DB4O session, store in another ('disconnected scenario')

I am trying to figure out how to keep an object useable between client sessions in DB4O. From what I understand, once a client session is closed, the object no longer resides in any cache and despite the fact that I have a valid UUID, I cannot call…
D. A. Terre
  • 6,092
  • 1
  • 18
  • 18
1
vote
2 answers

Comparing features in a asp.net web application using different database technologies

I have a webstore which sells components (it is a academic project) which looks like this. I have developed the same web application using following database technologies: MS Sql Server with Stored procedures and sql data reader LINQ to Sql DB4o…
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
1
vote
4 answers

Is Eloquera or db4o better suited for my web application?

I'm considering using an object oriented database in Visual Studio .NET for my web application, which is basically a web store. Which should I consider, Eloquera or db4o? Can I have some fresh perspective? A similar question was asked like 10 months…
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
1
vote
2 answers

web application in DB4O

If I'm going to develop a web application in ASP.NET using db4o what kind of database would it be: local or remote type, and why?
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
1
vote
1 answer

db4o native query in C#: how to find by first number?

I want to change last number of my every "No" for all students (who is born between 1996 and 1998) to 0, for example. (from 160456 to 1604560) I want to delete data for students whos "No" first 2 numbers is 14, for example. (user2.No = 143457;) How…
PogChamp
  • 39
  • 4
1
vote
3 answers

db4o Impedance Mismatch

I've built a nice repository layer around a db4o database to store Product objects, which relate to Manufacturer objects in a one-to-many relationship, i.e.: public class Manufacturer { public string Name { get; set; } } public class Product //…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
1
vote
1 answer

If I have 2 million rows in a db4o database, would you recommend a large flat table, or a hierarchy?

I have 2 million rows in a flat db4o table. A lot of the information is repeated - for example, the first column has only three possible strings. I could easily break the table into a 4-tier hierarchy (i.e. navigate from root >> symbol >> date >>…
Contango
  • 76,540
  • 58
  • 260
  • 305