Nested collections of simple objects

14 views
Skip to first unread message

rdspr...@gmail.com

unread,
Feb 24, 2015, 3:36:57 PM2/24/15
to mybatis...@googlegroups.com
I have a query:

select id, thing
from example
order
by id

I need to map this into a list of objects like this:

class Example
{
 
public int id;
 
public List<Thing> things;
}

"Thing" is custom object with no setters.  There is a registered type handler to create a thing from a column, which works perfectly with individual result mappings.

I am trying to create a mapper that will handle this. 

<resultMap id="exampleMap" type="Example">
 
<id property="id" column="id"/>
 
<collection property="names" ofType="Thing">
    ....
 
</collection>
</resultMap>

My problem is that I have no idea what would go in the body of the collection.  All of the examples revolve around complex types. 

Is this even possible?



Reply all
Reply to author
Forward
0 new messages