Hi Jim, Thanks for your enquiry. The result you're getting should indeed be of type Result<Record6<...>>, or if you don't care about the concrete record type: Result<?>. The result record type is determined by your SELECT clause. You're expicitly selecting 6 columns, not all the columns from all the tables. In other words, you're using this method from the DSLContext API:
http://www.jooq.org/javadoc/latest/org/jooq/DSLContext.html#select-org.jooq.Field-org.jooq.Field-org.jooq.Field-org.jooq.Field-org.jooq.Field-org.jooq.Field- <T1,T2,T3,T4,T5,T6> SelectSelectStep <http://www.jooq.org/javadoc/3.4.x/org/jooq/SelectSelectStep.html><Record6 <http://www.jooq.org/javadoc/3.4.x/org/jooq/Record6.html><T1,T2,T3,T4,T5,T6>> select( Field <http://www.jooq.org/javadoc/3.4.x/org/jooq/Field.html><T1> field1, Field <http://www.jooq.org/javadoc/3.4.x/org/jooq/Field.html><T2> field2, Field <http://www.jooq.org/javadoc/3.4.x/org/jooq/Field.html><T3> field3, Field <http://www.jooq.org/javadoc/3.4.x/org/jooq/Field.html><T4> field4, Field <http://www.jooq.org/javadoc/3.4.x/org/jooq/Field.html><T5> field5, Field <http://www.jooq.org/javadoc/3.4.x/org/jooq/Field.html><T6> field6) If you wanted to select all the columns from all the tables, you'd have to leave the SELECT clause empty: Result<Record> records = ivDsl.select() .from( sample ) .join( adj).on( sample.THRESHID = adj.THRESHID) .join( thr).on( sample.THRESHID = thr.THRESHID) .where( sample.SAMPLENO.between( startSampleno, lastSampleno +1 )) .fetch() ; You would then be using this method from the DSLContext API: http://www.jooq.org/javadoc/latest/org/jooq/DSLContext.html#select-org.jooq.Field...- SelectSelectStep <http://www.jooq.org/javadoc/3.4.x/org/jooq/SelectSelectStep.html><Record <http://www.jooq.org/javadoc/3.4.x/org/jooq/Record.html>> select(Field <http://www.jooq.org/javadoc/3.4.x/org/jooq/Field.html><?>... fields) I hope this answers your question. 2014-09-19 8:44 GMT+02:00 Jim McGlaughlin <[email protected]>: > I am trying to use JOOQ to get data out of three different tables. > > In MySql the query would be > > select sample.threshid, sample.sampleno, sample.v1, sample.v2, > adj.tpl, thr.DescId > from adjthr as adj, adjthrsample as sample, threshold as thr > where > sample.threshid = adj.threshid > and > sample.threshid = thr.ThreshId > > Using JOOQ I get syntax errors, the closest I come is something like > > Adjthrsample sample = Adjthrsample.ADJTHRSAMPLE; > Adjthr adj = Adjthr.ADJTHR; > Threshold thr = Threshold.THRESHOLD; > > Result<Record6<Integer,Integer,Float, Float, Integer, Integer>> > records = ivDsl.select( sample.SAMPLENO, sample.THRESHID, sample.V1, > sample.V2, adj.TPL, thr.DESCID ) > .from( sample ) > .join( adj).on( sample.THRESHID = adj.THRESHID) > .join( thr).on( sample.THRESHID = thr.THRESHID) > .where( sample.SAMPLENO.between( startSampleno, > lastSampleno +1 )) > .fetch() > ; > > From going through the forum and searching only, I don't think I can get a > Record6 result from this kind of join, I would get a flat result of all the > columns from all the tables. > If that were the case, I am not sure how I would parse the results. > > Not sure if I have the wrong kind of return Result, wrong kind of Select, > in addition to just plain bad understanding of JOOQ. But, I love it. > > Any suggested reading or explanation is greatly appreciated. > > Jim > > -- > 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. > -- 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.
