Code generation without hard coded schema?

989 views
Skip to first unread message

Witold Szczerba

unread,
Jan 28, 2013, 10:24:20 AM1/28/13
to jooq...@googlegroups.com
Hi,
I am using Oracle. Every developer and two staging environments share one database, everyone has theirs own database user.

The problem is, code generated on every computer is different, as it contains the schema name of particular user (or staging env).

In manual, I can see how can the input schema be configured. It can be also mapped to some other name, called "production", but... who is to tell what user name is going to be used on production server? Is it really that important to hard code production user name?

I can see a workaround, it is to configure Factory to ignore schema name in generated queries, but it is kind of a workaround. Still, the hard coded artificial user name is going to stay somewhere in application binaries.

Is it possible not to place schema name (in case of Oracle this is the user name) in generated code?

Thanks,
Witold Szczerba

Lukas Eder

unread,
Jan 30, 2013, 6:51:47 AM1/30/13
to jooq...@googlegroups.com
Hello Witold,

In manual, I can see how can the input schema be configured. It can be also mapped to some other name, called "production", but... who is to tell what user name is going to be used on production server? Is it really that important to hard code production user name?

I can see your point. Along with jOOQ 3.0's introduction for catalog support, some schema-related inconsistencies will be cleaned up as well. In jOOQ 3.0 "schema-less" databases such as CUBRID, Firebird, SQLite will become better integrated. Your use-case is also somewhat "schema-less" in a way that the concrete schema doesn't really matter to your application.
 
I can see a workaround, it is to configure Factory to ignore schema name in generated queries, but it is kind of a workaround. Still, the hard coded artificial user name is going to stay somewhere in application binaries.

Is it possible not to place schema name (in case of Oracle this is the user name) in generated code?

Currently, you cannot do it. I will register feature request #2133 for this, though:

The solution will be to specify an <outputSchema></outputSchema> (no name)

This has a high chance of being integrated in jOOQ 3.0 as it is a very useful addition also to others. Due to the expected merge complexity of this change, I'm not sure if I will be able to merge it to 2.7, easily

Cheers
Lukas

Witold Szczerba

unread,
Jan 30, 2013, 12:00:53 PM1/30/13
to jooq...@googlegroups.com
Great news, cannot wait for jOOQ 3.0 :)

Thanks,
Witold Szczerba


--
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Witold Szczerba

unread,
Jan 30, 2013, 12:02:51 PM1/30/13
to jooq...@googlegroups.com
Oops, I mean I wish it were here already, heh.

Lukas Eder

unread,
Feb 11, 2013, 9:17:56 AM2/11/13
to jooq...@googlegroups.com
This is now implemented for jOOQ 3.0. The change of semantics of the
code generation configuration is this:

Set outputSchema to the "default schema" (empty string). This will
result in a generated org.jooq.Schema that omits rendering its schema
name in generated SQL

<schemata>
<schema>
<inputSchema>TEST</inputSchema>
<outputSchema></outputSchema>
</schema>
</schemata>

Set outputSchema to "off" (null). This will result in a generated
org.jooq.Schema that renders the input schema name in generated SQL

<schemata>
<schema>
<inputSchema>TEST</inputSchema>
</schema>
</schemata>

2013/1/30 Witold Szczerba <pljos...@gmail.com>:

Witold Szczerba

unread,
Feb 11, 2013, 3:56:39 PM2/11/13
to jooq...@googlegroups.com
Thanks for update!

Regards,
Witold Szczerba
Reply all
Reply to author
Forward
0 new messages