Sure,

Here is the first fetch that the class runs into, the context is set from 
the above code:

List<String> countries =
context.selectDistinct(PT.ORDERING_COUNTRY)
.from(PULLTHRU)
.where(PT.ORDERING_COUNTRY.isNotNull()
.and((PT.ITEM_EXT_COST_USD.gt((double) 
0).or(PT.ITEM_EXT_PRICE_USD.gt((double) 0))))
.and(PT.ORDERING_COUNTRY.ne(""))
.and(PT.FLAG.le(0))
.and(PT.AGE.lessOrEqual(Integer.valueOf(AGELIMIT)))
.and(DSL.bitAnd(PT.PRODUCTS, productId).eq(productId)))
.orderBy(PT.ORDERING_COUNTRY.asc()).fetch().getValues(PT.ORDERING_COUNTRY, 
String.class);

and it produces the following log4j output -- which should be `T1`.`Pt_T` 
rathern than `Pt`

SELECT DISTINCT `T1`.`Pt`.`Ordering_Country`
FROM `T1`.`Pt`
WHERE (
  `T1`.`Pt`.`Ordering_Country` IS NOT NULL
  AND (
    `T1`.`Pt`.`Item_Ext_Cost_USD` > 0.0
    OR `T1`.`Pt`.`Item_Ext_Price_USD` > 0.0
  )
  AND `T1`.`Pt`.`Ordering_Country` <> ''
  AND `T1`.`Pt`.`flag` <= 0
  AND `T1`.`Pt`.`age` <= 180
  AND (`T1`.`Pt`.`products` & 1) = 1
)
ORDER BY `T1`.`Pt`.`Ordering_Country` ASC


On Friday, November 22, 2013 10:19:11 AM UTC-5, Lukas Eder wrote:
>
> Your configuration looks good to me. Could you also post the piece of code 
> that you're using to query the database? And if possible, some debug level 
> log output as documented here:
> http://www.jooq.org/doc/3.2/manual/sql-execution/logging/<http://www.google.com/url?q=http%3A%2F%2Fwww.jooq.org%2Fdoc%2F3.2%2Fmanual%2Fsql-execution%2Flogging%2F&sa=D&sntz=1&usg=AFQjCNG3T9QJZFO3LjXg9gRNnDhnx7cMrA>
>
>
> 2013/11/22 Aram Mirzadeh <[email protected] <javascript:>>
>
>>
>> Thanks, this looks very promising.   
>>
>> I did try this but I can't get the abstract class to use the mapping, 
>> it's still trying to pull the data from the main table rather than the view:
>>
>> I tried it with RenderSchema - true and false, with or without the 
>> MappedSchema, with only the input and no output -- none of the different 
>> changes made a difference in the actual run.
>> I even did a static import of the Tables.PT and PT_A and used the 
>> .getName() method for the values to make sure I wasn't mistyping anything.
>>
>> jConfig = new org.jooq.impl.DefaultConfiguration();
>> jConfig.set(new 
>> DefaultConnectionProvider(DBConnectionPool.getDBConnection()));
>>  jConfig.set(new DefaultExecuteListenerProvider(new 
>> DBStatisticsPrinter()));
>> jConfig.set(SQLDialect.MYSQL);
>>
>>  jConfig.settings().withRenderSchema(Boolean.TRUE)
>> .withRenderMapping(new RenderMapping()
>>  .withSchemata(new MappedSchema().withInput("T1").withOutput("T1")
>> .withTables(
>> new MappedTable()
>>  .withInput("PT")
>> .withOutput("PT_T"))));
>> context = DSL.using(jConfig);
>>
>> super.setContext(context);
>>
>> Thank you.
>>
>>
>> On Thursday, November 21, 2013 8:24:52 PM UTC-5, Aram Mirzadeh wrote:
>>>
>>>
>>> Hi, 
>>>
>>> I have multiple VIEWs that are based on a single table based on product 
>>> type. 
>>>
>>> TABLE
>>> TABLE_AAA 
>>> TABLE_BBB
>>> etc. 
>>>
>>> Since I have a single class that does all of my queries.  How do pass in 
>>> the table name which maybe one of the views to be used in the 
>>> .from(dynamicTable)?
>>>
>>> Thanks.
>>>
>>  -- 
>> 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/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.

Reply via email to