Chapter 5. Using the Java Binding

Table of Contents

Generating the Java code
A minimal client program
Compiling and running the application

Although the C++ binding is more complete than the Java binding - essentially according to the administrative operations - the Java bindings allow to manipulate data without limitations.

Using the Java binding is very similar to the C++ binding. Writing a Java program that can create, retrieve, modify and delete person instances that are stored in an EyeDB database involves the following steps:

This example is located in the examples/GettingStarted subdirectory.

Generating the Java code

The Java code is generated from the ODL schema definition using the following command:

% eyedbodl --gencode=Java --package=person person.odl
	  

The --package option is mandatory: this name will be used as the name of the Java package to which all generated Java classes will belong.

This command will generate a number of Java file in subdirectory person/, each generated file containing a Java class having the same name.

If you have a look to the files in sub-directory person, you will notice that the following classes have been generated:

  • the class Address

  • the class Database

  • the class Employee

  • the class Person

  • the class set\_class\_Person\_ref