Hello Lukas,

We also faced this problem.

Each developer in our environment has it's own schema, for example,
PROJCODE_DEV1,
PROJCODE_DEV2,
PROJCODE_TEST,
PROJCODE_PROD, etc..

We decided keep generated source code on version control (I hope,
temporarily).
Generated code has references to the schema PROJCODE_DEV1.
As a workaround, after generation, special ant script (using
maven-antrun-plugin) fixes several issues:

1.  renames PROJCODE_DEV1 to PROJCODE ( in runtime we use schema mapping
and map this name to PROJCODE_<schema_suffix>)

2.  changes data type of one column from java.sql.Date to
java.sql.Timestamp.
By default, jooq maps Oracle DATE type to java.sql.Date.
java.sql.Date doesn't contain time, but Oracle DATE type contains seconds.
So we have to change type of field in generated record, parameter in
procedure etc. (Fortunately, one column only :)
This problem is related to
http://groups.google.com/group/jooq-user/browse_thread/thread/4ad607718d4e9533
(no custom type mapping)

3. changes type of sequences from BigInteger to long. Most of primary keys
in our schema are NUMERIC(18,0) and jOOQ generates long type for them. I
thought that may be possible consider sequence's MAXVALUE for defining
type. For example, if we declare sequence with MAXVALUE 999999999999999999
(18 digits) then Long type will be selected, otherwise - BigInteger.

So, I agree with Daniel, it would be great to have additional configuration
parameter in jooq-codegen-maven, that defines target schema name:

                    <jdbc>
                        <schema>PROJCODE_DEV1</schema>
                    </jdbc>
                    <generator>
                        <target>
                            <schema>PROJCODE</schema>
                        </target>
                    </generator>

--
Best regards,
Sergey


On Sat, Nov 19, 2011 at 12:55 PM, Lukas Eder <[email protected]> wrote:

> Hi Sergey,
>
> Another, related issue to the question of whether schema introspection
> should be separated from code generation was discussed in this thread:
> https://github.com/lukaseder/jOOQ/issues/2
>
> It is an issue that's more focussed on a concrete problem that may arise
> from different development environment setups. As suggested by Daniel
> Carleton, schema name overriding at code generation time can solve some
> immediate problems in such setups. The separation of introspection and
> generation is much more general, though.
>
> Cheers
> Lukas
>

Reply via email to