java - How to map one-to-many relationships in myBatis? -


so have following table must map java objects:

+---------+-----------+---------------------+---------------------+--------+ | task_id | attribute | lastmodified        | activity            | row_id | +---------+-----------+---------------------+---------------------+--------+ |       1 |         1 | 2016-08-23 21:05:09 | first activity      |      1 | |       1 |         3 | 2016-08-23 21:08:28 | connect db       |      2 | |       1 |         3 | 2016-08-23 21:08:56 | create web services |      3 | |       1 |         4 | 2016-08-23 21:08:56 | data dump           |      4 | |       1 |         5 | 2016-08-23 21:08:56 | test cases          |      5 | |       1 |         6 | 2016-08-23 21:08:57 | dao object          |      6 | |       1 |         7 | 2016-08-23 21:08:57 | buy streetfood      |      7 | |       2 |         6 | 2016-08-23 21:08:57 | drink coke          |      8 | |       2 |         6 | 2016-08-23 21:09:00 | drink tea           |      9 | |       2 |         1 | 2016-08-23 21:12:30 | make tea            |     10 | |       2 |         2 | 2016-08-23 21:13:32 | charge phone        |     11 | |       2 |         3 | 2016-08-23 21:13:32 | shower              |     12 | |       2 |         4 | 2016-08-23 21:13:32 | sleep               |     13 | +---------+-----------+---------------------+---------------------+--------+ 

here, each task object( identified task_id column) has multiple attribute objects. these attribute objects have lastmodified, , activity fields. far approach has been create row object have each row of table mapped row object via mybatis. java-side processing sort out. there way directly map table via mybatis annotations and/or xml 2 task objects created each of them having list of populated atttribute objects inside?

here mybatis document:http://www.mybatis.org/mybatis-3/sqlmap-xml.html .may can use mybatis collection solve problem.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -