Hi Lukas
Thanks for your answer. I managed to get it to build with your suggested
dependency changes.
But it did not affect the resulting table names. In the example I would
expect the entity SampleTable to become SAMPLE_TABLE (it does when creating
the database through a spring boot application) but it ends up as
SAMPLETABLE.
When running maven build build with -X flag i get the following interesting
output:
[DEBUG] Executing query : select
"INFORMATION_SCHEMA"."TABLES"."TABLE_SCHEMA",
"INFORMATION_SCHEMA"."TABLES"."TABLE_NAME",
"INFORMATION_SCHEMA"."TABLES"."REMARKS" from "INFORMATION_SCHEMA"."TABLES"
where "INFORMATION_SCHEMA"."TABLES"."TABLE_SCHEMA" in (cast(? as varchar))
order by "INFORMATION_SCHEMA"."TABLES"."TABLE_SCHEMA",
"INFORMATION_SCHEMA"."TABLES"."TABLE_NAME"
[DEBUG] -> with bind values : select
"INFORMATION_SCHEMA"."TABLES"."TABLE_SCHEMA",
"INFORMATION_SCHEMA"."TABLES"."TABLE_NAME",
"INFORMATION_SCHEMA"."TABLES"."REMARKS" from "INFORMATION_SCHEMA"."TABLES"
where "INFORMATION_SCHEMA"."TABLES"."TABLE_SCHEMA" in ('PUBLIC') order by
"INFORMATION_SCHEMA"."TABLES"."TABLE_SCHEMA",
"INFORMATION_SCHEMA"."TABLES"."TABLE_NAME"
[DEBUG] Fetched result : +------------+------------+-------+
[DEBUG] : |TABLE_SCHEMA|TABLE_NAME |REMARKS|
[DEBUG] : +------------+------------+-------+
[DEBUG] : |PUBLIC |SAMPLETABLE | |
[DEBUG] : |PUBLIC |SAMPLE_TABLE| |
[DEBUG] : +------------+------------+-------+
[DEBUG] Fetched row(s) : 2
[DEBUG] Include : Including PUBLIC.SAMPLETABLE because of
pattern .*
[WARNING] Ambiguous type name : The object SAMPLE_TABLE generates a
type jooqexample.jooqmodel.tables.SampleTable which conflicts with the
existing type jooqexample.jooqmodel.tables.Sampletable on some operating
systems. Use a custom generator strategy to disambiguate the types.
[DEBUG] Exclude : Excluding PUBLIC.SAMPLE_TABLE because of
filter org.jooq.codegen.JavaGenerator$AvoidAmbiguousClassesFilter@48a46b0f
[INFO] Tables fetched : 2 (1 included, 1 excluded)
Any clues as to why hibernate creates both SAMPLETABLE & SAMPLE_TABLE?
Best regards Jens
On Tuesday, September 17, 2019 at 10:57:16 AM UTC+2, Jens Teglhus Møller
wrote:
>
> Hi
>
> I'm trying to get schema generation using JPADatabase to work with spring
> boot.
>
> In my initial testing I got everything working to the point where there
> was a mismatch with the table names when executing queries (generator not
> using same naming strategy as spring app).
>
> I have a 3 module maven setup with jpa-model, jooq-model and spring-app
> (simplified example can be seen here:
> https://github.com/djarnis73/jooq-spring-jpa-example).
>
> I saw the documentation regarding
> setting
> hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
>
> but when i do that the code generator fails since it cannot find the class.
>
> [ERROR] Failed to execute goal org.jooq:jooq-codegen-maven:3.12.1:generate
> (default) on project jooq-model: Error running jOOQ code generation tool:
> Error while exporting schema: Unable to resolve name
> [org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy]
> as strategy [org.hibernate.boot.model.naming.PhysicalNamingStrategy]:
> Unable to load class
> [org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy]:
> Could not load requested class :
> org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy ->
> [Help 1]
>
> I tried adding
>
> <dependency>
> <groupId>org.springframework.boot</groupId>
> <artifactId>spring-boot</artifactId>
> <version>${spring.boot.version}</version>
> </dependency>
>
> I also tried adding the dependency several other places, but I think it
> should be a plugin dependency.
>
> I have verified that
> org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy is
> in the org.springframework.boot:spring-boot jar file
>
> And when running maven with -X i get the following:
>
> [DEBUG] Populating class realm plugin>org.jooq:jooq-codegen-maven:3.12.1
> [DEBUG] Included: org.jooq:jooq-codegen-maven:jar:3.12.1
> [DEBUG] Included: org.springframework.boot:spring-boot:jar:2.1.8.RELEASE
> (others removed for brevity)
>
> I'm testing with jooq 3.12.1, spring boot 2.1.8.RELEASE
>
> I have not been able to get it working, can anyone give me a hint or point
> me to a working example.
>
> Best regards Jens
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jooq-user/9af136d7-e1ae-4d18-b1a4-ff10b2189023%40googlegroups.com.