I hear you, and am working (slowly unfortunately, have been in a month
long crunch at work) on just this type of tutorial (or Cookbook type
articles as Thomas or Matt referred to them).

I'd be more than happy to share what I have, except that it is currently
written up on dead trees (I think on dead trees) instead of digitally.

The best way I have found right now to get going on a standalone project
is as follows (in inarticulate and choppy form as I am taking a break
from previously mentioned crunch):

Download the source install. The binary install is a waste of time.

Configure the database stuff for your database (make sure to create the
needed database and user before building) and build OJB, then look
through the build.xml for the task that builds the testing database via
torque run just this target - it will generate the SQL and then actually
run it against the database (adding twenty some tables for unit
testing). All is not lost though, sql for dropping most of these tables
was generated so you don't have to do it by hand, look through the
target directory for the sql files and just c&p the drop parts of the
scripts into your command line sql client for everything except the
ojb_* tables.

This will leave you a couple tables that didn't drop because of
dependency issues (circular dependency tests), go in and drop the
constraints then the tables manually.

Now do a dump of your database schema, you have the sql to recreate the
OJB required tables for this database in the future. Is a pita, but is
how it is right now.

Okay, now build the WAR target from ant. You may not be doing a web app,
but the benefit of the war target is that it nicely pulls out only the
runtime required jars. You will unpack it and extract the jars from the
WEB-INF/lib/ directory and put em where you need them.

Finally, copy the OJB.properties, repository*.[xml|dtd] to your project
and you are good to go.

One thing OJB could really use is the equivalent of the struts-blank.war
minimal project. The ant WAR target is close to this, but it is rather
stilted towards web apps ;-) OJB requires a lot of libraries and a fair
bit of configurata, and tracking it all is not perfectly straightforward
(luckily I haven't hit version problems in updating the libraries OJB
depends on).

-Brian

On Tue, 2003-02-04 at 09:08, Mehmet D. AKIN wrote:
> 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 need an example like this, I have the simplest program with 2-3 classes,
> one is like
> 
> class Product{
>   int ID;
>   String name;
> methods..
> }
> 
> and a main class to test for accessing DB through OJB ,addin new records 
> etc.
> 
> so what now?
> 1. prepare xml config files?  where?
> 2. Prepare Database DTD? where?
> 3. Should I make a ojb.jar and add it to my project?
> 4. where should database driver jar's reside?
> 5. What more?
> 
> Sorry but I 'm a little frustrated by all that :).
> 
> I'd greatly appreciate any help
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to