Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackoverflow when using database.forcedTypes #27

Closed
advoretsky opened this issue Nov 29, 2016 · 6 comments
Closed

Stackoverflow when using database.forcedTypes #27

advoretsky opened this issue Nov 29, 2016 · 6 comments

Comments

@advoretsky
Copy link

When I add

forcedTypes = [
                    {
                        userType = 'java.time.LocalDateTime'
                        converter = 'com.company.dao.LocalDateTimeConverter'
                        expression = '.*\\.DATE_TIME.*'
                    }
               ]

under

jooq {
   main(sourceSets.main) {
      generator {
           database {

I get

java.lang.StackOverflowError
	at nu.studer.gradle.util.Objects.hasCustomHashCode(Objects.java:179)
	at nu.studer.gradle.util.Objects.deepHashCode(Objects.java:125)
	at nu.studer.gradle.util.Objects$DeepHashCodeComparator.compare(Objects.java:215)
	at nu.studer.gradle.util.Objects.sort(Objects.java:192)
	at nu.studer.gradle.util.Objects.deepHashCode(Objects.java:104)
	at nu.studer.gradle.util.Objects$DeepHashCodeComparator.compare(Objects.java:215)
	at nu.studer.gradle.util.Objects.sort(Objects.java:192)

on both 1.0.5 and 2.0.2 versions

@rui-gao
Copy link

rui-gao commented Dec 6, 2016

Running into the same issue when generating codes for MySQL with jooq version'3.8.5' and following configuration.

                forcedTypes = [
                    {
                        name = 'BOOLEAN'
                        types = '(?i:TINYINT(\\s*\\(\\d+\\))?(\\s*UNSIGNED)?)'
                    }
                ]

@uberbrodt
Copy link

Same, with jooq version 3.8.1 & plugin 2.0.2

                forcedTypes = [
                    {
                        userType = "java.lang.String"
                        binding = "com.traitify.jooq.customtypes.PostgresLTreeJooqBinding"
                        expression = ".*ORG_PATH"
                    }

@felipefzdz
Copy link
Collaborator

Hi @advoretsky, @demongaorui and @uberbrodt.

The proper way of including Jooq complex types with sequences has been documented here: https://github.com/etiennestuder/gradle-jooq-plugin#typical-pitfalls. An automated test that exercises that scenario has been added: https://github.com/etiennestuder/gradle-jooq-plugin/blob/master/src/test/groovy/nu/studer/gradle/jooq/JooqFuncTest.groovy#L103

/cc @lukaseder

@lukaseder
Copy link
Contributor

Hmm, interesting. Is there anything that could be done from the jOOQ side (backwards-compatibly) that would enable that Groovy list style? The jOOQ code generator configuration just works this way because this is standard practice when defining lists in XSD.

Would be really great if idiomatic configuration style could be used. After all, "idiomacy" is the main feature of this plugin, no?

@etiennestuder
Copy link
Owner

Hi @lukaseder. What we plan to do first of all is to provide better error reporting for scenarios like the one of this issue, so people can easily understand the problem and how to fix it.

I'm not sure I want to add two ways to specifying lists (and sets, etc.) in the DSL. Also, the DSL has no explicit goal to be idiomatic-Groovy. In contrary, the fact that the Gradle DSL is parsed by Groovy is more of an implementation detail.

The main feature of this plugin (or at least what drove me to write this plugin) is that you can declare the jOOQ source code generator configuration in your build build rather than in an external xml file.

@lukaseder
Copy link
Contributor

the fact that the Gradle DSL is parsed by Groovy is more of an implementation detail.

Interesting, I missed that bit. Thanks for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants