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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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?
Interesting, how does db4o prevent using Java 8? Or is this related to your moving to MySQL from another database?
Thank you very much for your offer. Right now, I don't think we should break compatibility with this change. In fact, let's wait and see if the change is necessary at all. Right now, we're evaluating whether the jOOQ 3.7 should support Java 8 (supporting Java 6 from the commercial jOOQ editions). A lot of great features can be derived if jOOQ Cursors can be turned into Streams directly. Once we support Java 8, we'll also move a bit of jOOλ (https://github.com/jOOQ/jOOL) functionality into jOOQ. In that case, grouping Results will be much easier with jOOQ...
Hey Lukas,I'm currently using the fetchGroups(Field[], RecordMapper<Record, T>) method, which does return a Map<Record, T>.
Is DSLContext.newRecord the best way to create a record for a lookup?