Daniel said:
If you REALLY REALLY want to go through the fields of a class (Bad
Idea)
Uhm, why? I'm quite sure, we are not alone here with the need to have an
object for every row return by an SQL-query...
Well, here is what I cooked up:
http://aldan.algebra.com/~mi/selfsetting/SelfSettingFromSQL.java.html
or
http://aldan.algebra.com/~mi/selfsetting/SelfSettingFromSQL.java
It will set the scalar fields and even arrays. The same java.sql.ResultSet
can be used to create (or set) different objects -- the columns without
matching fields in each object's class will simply be ignored.
A typical use would be to define your own class as "extends
SelfSettingFromSQL".
Hibernate does exactly what you want. Exactly what you want. Let me
repeat. Hibernate does exactly what you're trying to do.
NOW, I can go and look into how someone else has done it
Just know that I've gone down the road you're trying to. It isn't a
pretty journey, and the destination isn't all that nice either.
So far I like it

All I need now is declare the data-fields in my classes
and make sure, the SQL-queries return fields with matching names. The
tedious setting of every field (in every one of those classes) is now a
thing of the past.
The information about all the names and the types of all the fields is there
at run-time. Not using it is foolish...
-mi