Search code examples
javadatabaseapache-commonsapache-commons-dbutils

How do I populate database values into an existing object model?


I have a model instance already, it's a basic POJO, how can I populate it (by issuing a SELECT) with the values using dbutils by calling the setters which are named to match the table column names?

So BasicRowProcessor should match, I just don't find the appropiate class/method to call with the object as parameter.

There is only one instance I want to set, not an array.


Solution

  • I'm not sure I understand your question. Some source code would help.

    There are lots of libraries that perform ORM. See source forge for some ORM projects. One of them is sormula which I created. For the simplest use of it, see POJO zero-config example.