ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Agile Object to Relational Database Replication with db4o
Pages: 1, 2, 3, 4, 5, 6, 7, 8

Let's take a look at what's been stored. We can do this by running a query within a Java application, or by using db4o's graphical database browser, the ObjectManager (this needs to be downloaded separately from the main db4o distribution). We'll do the latter here, and look at an example of running a query later on. Figure 1 shows the ObjectManager interface.



Figure 1
Figure 1. The db4o ObjectManager

Browsing an object database is very different from browsing a relational one. There are no tables. Instead, the database contents are shown as an object tree, similar to the way local variables are often displayed by debuggers in IDEs. There is a separate root node for each class that is stored. The set of objects of a particular class is called the extent of the class.

Figure 2 shows the Customer node expanded to show the fields of each object. Each object is identified by an object ID (OID) value (e.g. 1225 for the first Customer). The first Customer is associated with its Address by holding a reference in its address field to the Address object with the OID 3108. The relationship is stored in almost exactly the same way it was represented in the objects in memory before they were stored. In contrast, in MySQL there will need to be matching values in the id fields in order to maintain associations.

Figure 2
Figure 2. The Customer object tree in the db4o database

Pages: 1, 2, 3, 4, 5, 6, 7, 8

Next Pagearrow