« Return to Thread: Mapping GroovyResultSet to POGOs?

Mapping GroovyResultSet to POGOs?

by Tom Nichols :: Rate this Message:

Reply to Author | View in Thread

I thought it was possible to "map" a GroovyResultset to a POGO like this:
class Person {
  String name
  String address
}

def sql = Sql.newInstance(...)
def people = []
sql.eachRow( "select name, address from person" ).eachRow { people <<
new Person( it ) }

This would be possible if the GroovyResultSet were interpreted as a
Map, correct?  i.e. the map would contain named properties that can
normally be passed to a constructor in Groovy.  Would this be possible
by adding an asType(Map) to GroovyResultset?

Thanks.
-Tom

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Mapping GroovyResultSet to POGOs?