JOOQ generator Using maven with MySQL DB

2,152 views
Skip to first unread message

Harmeet Singh

unread,
Apr 9, 2014, 10:59:42 AM4/9/14
to jooq...@googlegroups.com
Hello Friend, 
 I am trying to generate code using maven with MySQL db, but my logs produce some messages : 

Apr 09, 2014 8:10:52 PM org.jooq.tools.JooqLogger info
INFO: Emptying                 : D:\Workspace\JOOQ\jooq-samples\src\main\java\com\the13star\entities\com\the13star\entities
Apr 09, 2014 8:10:52 PM org.jooq.tools.JooqLogger warn
WARNING: No schemata were loaded  : Please check your connection settings, and whether your database (and your database version!) is really supported by jOOQ. Also, check the case-sensitivity in your configured <inputSchema/> elements : [public]
Apr 09, 2014 8:10:52 PM org.jooq.tools.JooqLogger info
INFO: Generating schemata      : Total: 0

My maven File as Follow : 

<plugin>

<!-- Specify the maven code generator plugin -->
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.3.1</version>
<!-- The plugin should hook into the generate goal -->
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>

<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
</dependency>
</dependencies>

<!-- Specify the plugin configuration. The configuration format is the 
same as for the standalone code generator -->
<configuration>
<!-- JDBC connection parameters -->
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost/jooq_test</url>
<user>root</user>
<password>root</password>
</jdbc>

<!-- Generator parameters -->
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<database>
<name>org.jooq.util.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>public</inputSchema>
</database>
<target>
<packageName>com.the13star.entities</packageName>
<directory>src/main/java/com/the13star/entities</directory>
</target>
</generator>
</configuration>
</plugin>

what is the problem is that . In my MySQL db, the jooq_test db is present and one table is there user_detail. So What i do ? 

Lukas Eder

unread,
Apr 9, 2014, 12:01:15 PM4/9/14
to jooq...@googlegroups.com
Hello Harmeet,

The relevant error message reads:

WARNING: No schemata were loaded  : Please check your connection settings, and whether your database (and your database version!) is really supported by jOOQ. Also, check the case-sensitivity in your configured <inputSchema/> elements : [public]

And you're also trying to select the public schema as your inputSchema:

<inputSchema>public</inputSchema>

"public" is a schema typically available in H2, HSQLDB, and PostgreSQL databases. By default, MySQL does not have such a schema. You should replace that schema name by the one you're using, probably "jooq_test". Another option is to remove that XML element and generate all schemas.

Hope this helps,
Lukas

--
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/d/optout.

Harmeet Singh

unread,
Apr 9, 2014, 1:29:08 PM4/9/14
to jooq...@googlegroups.com
Thanks Lukas, My Code is generated Successfully, following is my Generator :

<!-- Generator parameters -->
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<database>
<name>org.jooq.util.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes></excludes>
       <inputSchema>jooq_test</inputSchema>
</database>
<target>
        <packageName>com.the13star.entities</packageName>
<directory>src/main/java</directory>
</target>
</generator>

We need to set the value in <inputSchema>jooq_test</inputSchema> tags. if this tag is not used, the generator generate code for all database.

But Still I Facing on problem in generated Code. There is one file generate "UserDetailRecord.java" in this, compile time error occurs :

Multiple markers at this line
- implements 
org.jooq.Record3<java.lang.Integer,java.lang.String,java.lang.Integer>.field1
- The method field1() of type UserDetailRecord must override a superclass method

Why this error produce, and how to resolve this error ? 

Lukas Eder

unread,
Apr 9, 2014, 1:39:08 PM4/9/14
to jooq...@googlegroups.com
Hello Harmeet,

I suspect you are not using the same jOOQ version to generate code as you're using to compile / run that code

Harmeet Singh

unread,
Apr 9, 2014, 1:46:36 PM4/9/14
to jooq...@googlegroups.com
Hello Lukas, I am using JOOQ 3.3.1 version or generating code or for compiling code. 

Harmeet Singh

unread,
Apr 9, 2014, 1:46:41 PM4/9/14
to jooq...@googlegroups.com

Harmeet Singh

unread,
Apr 9, 2014, 2:18:19 PM4/9/14
to jooq...@googlegroups.com
Hello Lukas, The problem is solved, there is the error of JDK related, because maven by default use JDK 1.5 and our code is generated according to 1.7, the override annotations are for interface are include in 1.6, that's why the error occur. Now the error is resolved and thanks for you support. 

Lukas Eder

unread,
Apr 10, 2014, 12:58:00 AM4/10/14
to jooq...@googlegroups.com
Hi Harmeet,

True, I hadn't thought of that option. Yes, jOOQ supports Java 6 upwards only,

Best Regards,
Lukas


2014-04-09 20:18 GMT+02:00 Harmeet Singh <harmeets...@gmail.com>:
Hello Lukas, The problem is solved, there is the error of JDK related, because maven by default use JDK 1.5 and our code is generated according to 1.7, the override annotations are for interface are include in 1.6, that's why the error occur. Now the error is resolved and thanks for you support. 

--

onema...@gmail.com

unread,
Sep 17, 2018, 3:54:39 PM9/17/18
to jOOQ User Group
Thank you!!! Took me a while to figure this out and your post worked for me immediately 
Reply all
Reply to author
Forward
0 new messages