Re: SchemaMapping feature not considered in "getSQL()" Method

Showing 1-8 of 8 messages
Re: SchemaMapping feature not considered in "getSQL()" Method Lukas Eder 10/20/11 12:34 AM
Hello Bert,

> But i also have to evaluate, if it is possible to get only the SQL
> Statement out of the SQL Builder and execute the statement outside of
> jooq, e.g. over Spring JDBC Template => so i used the getSQL() Method.

That's an interesting approach. I've seen that before, e.g. here:
http://stackoverflow.com/questions/4474365/jooq-and-spring#6796688

> But here the schema mapping is not considered => is this the expected
> behaviour ?

That is not expected. Both SQLDialect and SchemaMapping should be
considered in this case. I'll further analyse this potential bug:
https://sourceforge.net/apps/trac/jooq/ticket/880

> is there any way/workaround to do this ?

Does this work, in the mean time?

Factory factory = new Factory(connection, dialect, mapping);
String sql = factory.render(query);

Cheers
Lukas

unk...@googlegroups.com 10/20/11 12:17 AM <This message has been deleted.>
Re: SchemaMapping feature not considered in "getSQL()" Method Lukas Eder 10/20/11 9:37 AM
Hello Bert,

>> But here the schema mapping is not considered => is this the expected
>> behaviour ?
>
> That is not expected. Both SQLDialect and SchemaMapping should be
> considered in this case. I'll further analyse this potential bug:
> https://sourceforge.net/apps/trac/jooq/ticket/880

I could not reproduce this issue. Query.getSQL() correctly renders
mapped schemata in my integration tests. Maybe you can provide me with
some code to reproduce the issue? How are you constructing your Query?

Cheers
Lukas

unk...@googlegroups.com 10/20/11 9:38 AM <This message has been deleted.>
unk...@googlegroups.com 10/21/11 12:41 AM <This message has been deleted.>
unk...@googlegroups.com 10/21/11 12:48 AM <This message has been deleted.>
Re: SchemaMapping feature not considered in "getSQL()" Method Lukas Eder 10/21/11 12:59 AM
Hello Bert aka Ralf :-)

I just now realise that this is actually a bug that's already fixed
for jOOQ 1.6.8!

http://sourceforge.net/apps/trac/jooq/ticket/847

#880 is in fact a duplicate. With jOOQ 1.6.8 (which I'll release this
weekend), Query.getSQL() should work correctly again.

Cheers
Lukas

2011/10/21 bert <bert...@gmail.com>:
> Hello Lukas,
>
> Here my statement, maybe i am doing something basic the wrong way:
>
> SchemaMapping mapping = new SchemaMapping();
> mapping.add(Test.TEST, "PROD");
>
> Factory berechtigung = new Factory(getConnection(), SQLDialect.ORACLE,
> mapping);
>
> Query query = berechtigung
>          .select(Kunde.KURZBEZEICHNUNG)
>          .from(Kunde.KUNDE)
>          .where(Kunde.BEZEICHNUNG.equal("NAME1"));
>
> System.out.println(query.getSQL());
> //not working - console output:
> //select TEST.KUNDE.KURZBEZEICHNUNG from TEST.KUNDE where
> TEST.KUNDE.BEZEICHNUNG = ?
>
> System.out.println(berechtigung.render(query));
> //working - console output:
> //select "PROD"."KUNDE"."KURZBEZEICHNUNG" from "PROD"."KUNDE" where
> "PROD"."KUNDE"."BEZEICHNUNG" = ?
>
> cheers
>
> Bert aka Ralf ;-)

unk...@googlegroups.com 10/21/11 4:39 AM <This message has been deleted.>