This reminds me of:
http://ninjahumor.com/wp-content/uploads/2013/05/My-code-doesnt-work-I-have-no-idea-why-My-code-works-I-have-no-idea-why.jpg

:-) Good thing it works now!
Cheers
Lukas


2013/11/22 Aram Mirzadeh <[email protected]>

>
> I'm not sure what the problem was, but I created a JUNIT test using that
> same class and it worked.
> I copied and pasted the same exact code back into the original class and
> it started working.
>
> Maybe I should have done a full cleand recompile in Eclipse -- something
> may just have been stale and needed to refresh.
>
> The byName() method worked.
>
> Aram
>
>
> On Friday, November 22, 2013 10:40:58 AM UTC-5, Lukas Eder wrote:
>
>> Hmm, at first, I was going to suspect a case-sensitivity problem, but
>> then you said you were using getName() to get the naming straight. Still,
>> as I see things, the table name is `Pt` with a capital P and a lower-case
>> t. So when you pass this information to the MappedTable, you should get
>> casing right. I.e., write:
>>
>> new MappedTable()
>> .withInput("Pt")
>>  .withOutput("Pt_T"))));
>>
>> Instead of
>>
>> new MappedTable()
>> .withInput("PT")
>>  .withOutput("PT_T"))));
>>
>>
>> 2013/11/22 Aram Mirzadeh <[email protected]>
>>
>>
>>> 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<http://www.google.com/url?q=http%3A%2F%2FPT.ITEM_EXT_COST_USD.gt&sa=D&sntz=1&usg=AFQjCNHXRI_GJpnI9J4andEaX5e7Bl_YHw>
>>> ((double) 
>>> 0).or(PT.ITEM_EXT_PRICE_USD.gt<http://www.google.com/url?q=http%3A%2F%2FPT.ITEM_EXT_PRICE_USD.gt&sa=D&sntz=1&usg=AFQjCNHsAHiUigg-HNF4okhEcfmFc6BECw>((double)
>>> 0))))
>>>  
>>> .and(PT.ORDERING_COUNTRY.ne<http://www.google.com/url?q=http%3A%2F%2FPT.ORDERING_COUNTRY.ne&sa=D&sntz=1&usg=AFQjCNEyCkPaSE7NLQUTfjaqZDKZR0f5oQ>
>>> (""))
>>> .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]>
>>>>
>>>>>
>>>>> 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].
>>>>>
>>>>> 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.
>>>
>>
>>  --
> 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.
>

-- 
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