Object-oriented database management system written in Java
This is very simple database management system written in Java. It uses Java binding for
data manipulation and doesn't support OQL language. It doesn't support data transfering through
network, so your application has to be at the same JVM as OODBMS is. It supports multi-threaded
calls.
NOTE: This OODB can't be used in the production systems. In educational purpose only.
Features:
- ODMG 3.0 implementation
- Java binding
- Multi-thread
- Stores information in Java serialized files
- Doesn't support big size of content (all data are located in memory)
At the JVM startup this OODBMS loads all data from serialized files into the memory. Any
applications can manipulate with this data (INSERT, SELECT, DELETE queries). At the JVM close it
serializes all data from the memory into the files.
Each object has four major properties:
- oid - object identifier which is unique within the database.
- version - each access to this object via Extent or lookup() call should increase
version number.
- lockMode - type of locking of this object. Can be Transaction.READ | Transaction.UPGRADE
| Transaction.WRITE
- action - type of action. Can be INSERT | DELETE | NORMAL. At object creation it
automatically receive action INSERT.
Description |
File |
Size |
Date |
Location |
OODB v0.1 (with sources and 2 databases: Buyer-Supplier and
Student-Lecturer) |
oodb.zip |
182 Kb |
22 May 2002 |
Russia |
OODB description (in Russian) |
oodb.pdf |
591 Kb |
22 May 2002 |
Russia |
Example of database creation
In order to create a new database for this OODBMS you have to create a set of classes
(tables in relational databases) by subclassing an abstract MetaObject class and defining the
following methods. For instance, let us create a class Lecturer:
public class Lecturer extends lv.tsi.oodb.core.MetaObject {
private lv.tsi.oodb.odmg.SetOfObject students = new lv.tsi.oodb.odmg.SetOfObject();
private String name;
public Lecturer( String name ) { this.name = name; }
public void addStudent( Student stud ) { students.add( stud ); }
public SetOfObject getStudents() { return students; }
public String toString() { return name; }
}
Then we could make a transaction to the database (we assume that class Student allready
exists). At the beginning we open database (load all data into the memory), then make a select
query (get a lecturer with a surname "Smirnof"), and at the end close the database.
lv.tsi.oodb.odmg.Database db = new lv.tsi.oodb.odmg.Database();
// ------------------------------------------------
// | Opening the database
// ------------------------------------------------
try {
System.out.print( "Opening database..." );
db.open( "student", Database.OPEN_READ_WRITE );
System.out.println( "ok." );
} catch (ODMGException e) {
System.out.println( "error.\nExited." );
System.out.print( e.getMessage() );
System.exit(1);
}
// ------------------------------------------------
// | Select query
// ------------------------------------------------
long time = System.currentTimeMillis();
lv.tsi.oodb.odmg.Transaction txn = new lv.tsi.oodb.odmg.Transaction( db );
txn.begin();
try {
Lecturer p = (Lecturer)db.lookup("Smirnof");
System.out.println("Lecturer: " + p );
} catch (Exception e) {
txn.abort();
}
txn.commit();
System.out.println("Time: " + (System.currentTimeMillis() - time) );
// ------------------------------------------------
// | Closing the database
// ------------------------------------------------
try {
System.out.print( "Closing database..." );
db.close();
System.out.println( "ok." );
} catch (ODMGException e) {
System.out.println( "error.\nExited." );
System.out.print( e.getMessage() );
}
OODBMS kernel written by Alexey Vasilyev
OODBMS databases (Buyer-Supplier and Lecturer-Student) written by Alexey Gulyaev
Сайт управляется системой
uCoz