0

I know how to use BeanPropertyRowMapper and RowMapper as well.

But if I use BeanPropertyRowMapper, i.e.

BeanPropertyRowMapper<MyClass> rowMapper = new BeanPropertyRowMapper<MyClass>(MyClass.class);

MyClass attributes becomes tightly coupled with tables column names and if I use RowMapper still MyClass attributes becomes tightly coupled and I have to write few more lines of code populate MyClass attribute with first GET and then SET operation extra.

Is there any way we can get rid of this dependency. Even after Table Columns names are changed, MyClass attributes should be populated as before and I do not need to change my code.

1

1 Answer 1

0

The Dozer mapping tool sounds like a good fit for what you're trying to do, and it's pretty simple to use. You'd still have to change something when changing column names, but it should be pretty easy. Check this out: http://dozer.sourceforge.net/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.