> Hi Everyone,
>
[quoted text clipped - 4 lines]
>
> Thanks!
Actually, to clear up my post, I've read that the most common way to return
values from a database is to iterate through a ResultSet and creating an
object that holds a copy of the data of each row. Then placing the objects
in a collection. What happens when you're returning a table of 20 or 30
columns. That's quite a bit of typing. Is there a simplier way to do this?
James McGill - 07 Apr 2006 17:53 GMT
> Is there a simplier way to do this?
http://www.hibernate.org
http://java.sun.com/blueprints/patterns/DAO.html
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
http://www.castor.org/
john gresh - 07 Apr 2006 17:58 GMT
You could write a code generator that reads the data dictionary of the
database (eg all_tables, all_tab_columns, etc. in oracle) and generates
the appropriate .java file for a specified table or collection of
tables.
> Is there a dynamic way of creating
> DTOs/JavaBeans?
I use Castor. While it's not a JAXB implementation, it has a builder
that will create your DTOs by parsing an XML schema.
For DAO, I then just write hibernate mappings for these objects. We
have a custom doclet for doing this but I don't use it. It's too easy
just to do it, the automation becomes an extra layer of complexity that
we don't need.