jooq-utilities is a small open source library that enhances jOOQ
Add a dependency to the current version:
<dependency>
<groupId>ch.martinelli.oss</groupId>
<artifactId>jooq-utilities</artifactId>
<version>1.1.2</version>
</dependency>
By default, jOOQ generates equals() and hashCode() with all fields. But sometimes it is useful to have only the primary key fields.
EqualsAndHashCodeJavaGenerator
is a JavaGenerator
that adds equals()
and hashCode()
to the generated Records
based on the PrimaryKey.
Add EqualsAndHashCodeJavaGenerator
to jooq-codegen-maven
like this:
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<generator>
<name>ch.martinelli.oss.jooq.EqualsAndHashCodeJavaGenerator</name>
...
</generator>
</configuration>
</plugin>
jooq-utilities is open and free software under Apache License, Version 2: http://www.apache.org/licenses/LICENSE-2.0.html