Conveniently convert a row from a JDBC resultset to a java object given that the database follows uppercase-underscore naming convention with names matching java object field names.
IE
USER_DETAIL.USER_ID
USER_DETAIL.NUMERICAL_ID
USER_DETAIL.FIRST_NAME
USER_DETAIL.LAST_NAME
USER_DETAIL.PASSWORD
USER_DETAIL.BIRTH_DATE
public class User {
String userId;
Integer numericalId;
String firstName;
String lastName;
String password;
Date birthDate;
... + getters and setters for these fields
}
DataSourceToPojoMapper dataSourceToPojoMapper = new DataSourceToPojoMapper();
ResultSet rs = preparedStatement.execute();
List<User> users=new ArrayList<User>();
while (rs.next())
{
User user = dataSourceToPojoMapper.getMappedObj(rs, User.class);
users.add(user);
}