JODB Help
Written by JODB Master   
Wednesday, 16 May 2007

If you happened to stop by here without any knowledge of S.O.D.A. or By-Example queries ..., than you'll definitely do better at db4o site. Unfortunately I can't afford full featured tutorials at this moment. Here I will outline some significant features and requirements that differentiate JODB and DB4Objects.



Java VM version
JODB Installation
Getting ObjectContainer
Transient vs @JODBTransient
Strings are objects
Exceptions
Object Factory
Client/Server "Transaction Resolver"
Native Queries
Running Mini JODB on Android

 

Java VM version

JODB designed to work with JDK1.5 or later. It shouldn't be complicated to make it compatible with JDK1.4 except that Annotations introduced only in 1.5 version and it happened to be critical to have feature (why? - see Transient vs @JODBTransient).

JODB Installation

Add JODB_xx.jar file from distribution to classpath and you're good to go.

Getting ObjectContainer

ObjectContainer - the cornerstone of all database operations - can be obtained via JODB. open(...) factory method. 

Transient vs @JODBTransient

As the java developer you should probably know the meaning of transient modifier which basically marks members as excluded from default serialization process. The DB4O authors have decided to use this modifier as indicator that field should not be persisted in database. This fact creates potential problems since though the process which used for object data assembling is not entirely compliant with serialization process if custom read/write methods are defined. To overcome this limitation JODB uses custom annotation com.mobixess.jodb.core.JODBTransient that can be used to mark fields if you don't need them to be persisted.

 

Strings are objects

The strings in JODB are persisted and can be consequently searched as objects. Not really sure why it doesn't work for db4o folks.

 

Exceptions

The JODB transparently declares standard java IOException for all API methods that can potentially modify underlying data file.

The com.mobixess.jodb.core.IllegalClassTypeException is the equivalent of com.db4o.ext.ObjectNotStorableException and declared for all API methods that may potentially instantiate or persist 'unsavable' objects. See "Object factory" for related information. 

Object Factory

Similar to its more advanced contender the JODB searches for object constructor that accepts default parameters (zeros or nulls) without throwing any exception. If no such constructor is found than IllegalClassTypeException is thrown. To overcome this problem you can implement IObjectInstanceProvider interface and register it with JODBObjectInstanceFactory factory.

 

More coming soon. Stay tuned ...