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

434 views
Skip to first unread message
Message has been deleted

Lukas Eder

unread,
Oct 20, 2011, 3:34:43 AM10/20/11
to jooq...@googlegroups.com
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

Lukas Eder

unread,
Oct 20, 2011, 12:37:01 PM10/20/11
to jooq...@googlegroups.com, bert...@gmail.com
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

Message has been deleted
Message has been deleted
Message has been deleted

Lukas Eder

unread,
Oct 21, 2011, 3:59:03 AM10/21/11
to jooq...@googlegroups.com
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 ;-)

Reply all
Reply to author
Forward
Message has been deleted
0 new messages