Unfortunately there are date ranges with the same start date and unfortunately we can't move to Java 8 because we're still using db4o :( but we're moving to MySQL and jOOQ's been great so far.
Thanks for the clarification though! Do you think moving towards using a record instead of a list is something worth being contributed? On Tuesday, May 19, 2015 at 11:56:36 AM UTC-4, Lukas Eder wrote: > > Hello Tariq, > > Unfortunately, the fetchMap() API was added a bit early in jOOQ's history, > which is why it returns a Map<List<?>, Boolean> type rather than a > Map<Record, Boolean> type as it should, where Record would probably be a > bit more like what you're looking for. > > From your example, I take that you're not using Java 8 yet, where custom > grouping via Streams and lambdas becomes easier to implement at your side. > > A workaround would be to use only START_DATE for grouping, as I would > imagine that your blocks are mutually exclusive date ranges... Otherwise, > you'll probably have to write (or use) some third-party library code > yourself, I'm afraid. > > Cheers, > Lukas > > 2015-05-19 15:51 GMT+02:00 Tariq Bugrara <[email protected] <javascript:>> > : > >> Hey I have a query like this: >> >> Map<List<?>, Boolean> dateRangeExistsMap = context >> .select(BLOCK_ASSIGNMENT.START_DATE, BLOCK_ASSIGNMENT.END_DATE, >> DSL.field(DSL.count().ge(1))) >> .from(BLOCK_ASSIGNMENT) >> .groupBy(new Field<?>[]{BLOCK_ASSIGNMENT.START_DATE, >> BLOCK_ASSIGNMENT.END_DATE}) >> .fetchMap(new Field<?>[]{BLOCK_ASSIGNMENT.START_DATE, >> BLOCK_ASSIGNMENT.END_DATE}, >> new RecordMapper<Record3<LocalDate, LocalDate, Boolean>, >> Boolean>() { >> @Override >> public Boolean map(Record3<LocalDate, LocalDate, Boolean> >> record) { >> return record.value3(); >> } >> }); >> >> >> I was wondering if there was a better way to create the map so doing a >> lookup wouldn't require the creation of a list? The only issue I have with >> this approach now is that the order the elements are inserted must match the >> order of fields in the fetchMap. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
