Hello,

I started with OJB approx. 2 months ago.

> -----Original Message-----
> From: Mehmet D. AKIN [mailto:[EMAIL PROTECTED]]
> 
> Is there any step by step isolated example for basic usage of OJB? I 
> found the tutorials a little complex. I'm not meaning the 
> java codes but 
> the whole configuration steps are really messed up in my 
> mind. There are 
> OJB code, ant tasks, torque tasks, source code, tutorial 
> code, several 
> XML documents, What steps should I do to prepare a single simple 
> *isolated* example?

I made the same experience.  The out-of-the-box experience
of OJB is indeed frustrating.  An *isolated* example is
exactly what we need, in particular because the error messages
of OJB are not really helpful is case of typos or the like.

here is what I did:
I copied the hole OJB installation directory, and then 
modified the build-process step-by-step in order to get 
a relatively isolated example, just to see something running
that I could modify.  

Unfortunately, the example has grown by now, so sharing
it with you would not be of any use.

If you do not what to do it the same way, you might succeed
as follows:

1. run the test suite out-of-the-box 
(see http://jakarta.apache.org/ojb/quickstart.html)

2. inspect the directory <INSTALL_DIR>/target/test.
Its subdirectory ojb is the current working 
directory during the tests.

Here you find two important runtime 
configuration files:
        target/test/ojb/repository.xml
        target/test/ojb/OJB.properties
Do not exchange the latter with
        target/test/OJB.properties,
that is the database!  The first one includes the other
repository_*.xml files by xml means.


3. inspect the directory 
<INSTALL_DIR>/target/srctest/org/apache/ojb/tutorial1
There you find the sources for the tutorial1

4. Copy tutorial1 into a separate directory tree,
  copy the runtime configuration files described above
  into some-new-directory/ojb.  
  Get rid of the some-new-directory/ojb/repository_ejb.xml, and
  maybe the some-new-directory/ojb/repository_junit.xml 
  by removing their includes
  from some-new-directory/ojb/repository.xml

  Try to run your copy of the tutorial1 with some-new-directory/ojb  
  location, with all <INSTALL_DIR>/lib/*.jar stuff in the classpath.
  
  When you have reached the point where hsql tries to
  open the database, and empty database will be created 
  (two files named some-new-directory/OJB.properties and 
  some-new-directory/OJB.script)
  The required tables will be missing and a corresponding
  error exception will be thrown.

  You find scripts that generate the tables in
        <INSTALL_DIR>/target/src/sql/*-schema.sql
  Use one of the hsqdb tools (see below) to run them.

5. A helpful tool is the Hsqldb gui tool.  You can use
   it to administrate and inspect hsql (file-) databases.
   To start it, make sure the 
        <INSTALL_DIR>/lib/hsqldb.jar in your classpath
   and run 
        java org.hsqldb.util.DatabaseManager -url jdbc:hsqldb:OJB
   with some-new-directory as current working directory.
   (OJB is the database name here.)
  
Good luck!
Olli
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to