Hi,

instead of the mor advanced RowSet, I'd use the classic ResultSet ...


> I'm not familiar with that class - can you tell me what it does, from a high 
> level?
I'm not a Spring expert, but I'll try to explain in a simple way, as i
know it :-) :
Given the ResultSet, the developer write an implementation of the
RowMapper, where he maps the returned results rows to his objects, or
better, for any row he maps the returned columns to domain object
fields ...

this is a sample usage as anonymous inner classes (taken from here
http://static.springframework.org/spring/docs/2.5.x/reference/jdbc.html
):

public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
            Actor actor = new Actor();
            actor.setFirstName(rs.getString("first_name"));
            actor.setSurname(rs.getString("surname"));
            return actor;
        }

in this way the developer knows what are fields in the ResultSet, and
what to do with any field, right ? So in this way the mapping of rows
on domain objects (in the sample it's the Actor class) is leaved to
the developer, without having Class mappings that could lead to
problems with various Serializers (like some data types not
serializable for example by the JSONSerializer, like Date, etc) ...

Maybe in this way the implementation could be simpler than transform
any resultset field Class to another value ...

What do you think ?


> Not in the way I am currently envisioning it would work. It would support 
> wrapping a single ResultSet only (but maybe you could use multiple instances 
> to solve your use case)?
Ok, this can work ... maybe for the future we could think to handle
also the more generic case.

Sandro

Reply via email to