To use this client, you must first compile it using a standard Makefile, as follows (replace
<<datadir>> with the data directory, usually
include <<datadir>>/eyedb/Makefile.eyedb all: PersonTest.class person/Database.java: schema.odl $(EYEDB_ODL) --gencode=Java --package=person --output-dir=person $< PersonTest.class: PersonTest.java person/Database.java CLASSPATH=$(EYEDB_CLASSPATH):. javac *.java person/*.java
Once compiled, you can execute the program as follows:
CLASSPATH=. eyedbjrun PersonTest person_g
The eyedbjrun script is a helper script that wraps the call to the Java
virtual machine with an appropriate CLASSPATH environment variable containing the path to
eyedb.jar and passes the necessary options to the
A few remarks about the Java code:
all operations - setting, getting attributes, storing, querying instances in a database - must be performed within a transaction. A transaction is initiated using the
Database::transactionBegin method and is committed (resp. aborted) using the
to store any instance in the database, you need to call the
realize) method on this instance. In our case, we use the argument
FullRecurs indicating that we want all related instances (through relationship or indirect attribute) to be stored in the database.
The Java binding support both the standalone applications and the applets.
To have more information about the Java binding, please refer to the EyeDB Java binding manual.