Hi,
I have a table as follow.
+----------------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+-------------------+-----------------------------+
| seq | int(11) | NO | PRI | NULL | auto_increment |
| id | varchar(36) | NO | | NULL | |
| edu_content_id | varchar(36) | NO | MUL | NULL | |
| reason | varchar(200) | NO | | NULL | |
| media_type | varchar(255) | NO | | NULL | |
| file_name | varchar(255) | NO | | NULL | |
| revision | int(1) | NO | | 1 | |
| description | varchar(250) | NO | | NULL | |
| comment | varchar(250) | YES | | NULL | |
| num_pages | int(4) | YES | | 0 | |
| created_ts | timestamp | NO | | CURRENT_TIMESTAMP | |
| updated_ts | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+----------------+--------------+------+-----+-------------------+-----------------------------+
This table stores one-to-many relationship with the edu_content_id column value.
I wanted to send a list of edu_content_id and fetch a Map<String, List<EduContent>> values.
I was trying to see if I can use .intoGroups() function from Jooq but getting confused.
My query is basically as follows. I just need revision and created_ts and Map into EduContent entity. End of the day the Map key is edu_content_id and value is a List if EduContent which will only have revision and created_ts.
dsl.select(
EDU_REVISED_CONTENT.REVISION,
EDU_REVISED_CONTENT.CREATED_TS)
.from(EDU_REVISED_CONTENT)
.where(EDU_REVISED_CONTENT.EDU_CONTENT_ID.in(eduContentIds)).orderBy(EDU_REVISED_CONTENT.CREATED_TS.desc()).fetch();
Just wanted to know if this is possible by using a Jooq query.
Thanks In advance.
Thanks,
Deba