You could checkout a tool called Middlegen.
EJBX tool is very good. it creates lots of useful code(CMP,value objects, facade session,business delegate, struts) by just giving the database and tables information. You can find out about that tool at www.myhtg.com
Thanks for your replies!
I've checked Middlegen, but it can't create
cmp-relationships. Also, I've checked Together CC.
It _can_ create UML diagram from the database, but
it can't create cmp-relationships (though they are
shown in UML diagram!).
And EJBX costs $200. Is it worth bying?