Jooq 3.10.4, codegen, and play 2.5 cannot find indexes

513 views
Skip to first unread message

Alex Mueller

unread,
Jan 31, 2018, 10:11:43 PM1/31/18
to jOOQ User Group
My play app was working fine with Play 2.5 and Jooq 3.7.3. I have replaced 3.7.3 with 3.10.4. Now I am getting compile errors, hopefully it is something easy to figure out. Most of my Jooq generated pojos and records fail with this error.

Error:(31, 54) java: cannot find symbol
  symbol:   method indexes()
  location: @interface javax.persistence.Table

/**
 * This class is generated by jOOQ.
 */
@Generated(
    value = {
        "http://www.jooq.org",
        "jOOQ version:3.10.4"
    },
    comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
@Entity
@Table(name = "positions", schema = "sd2", indexes = {
    @Index(name = "idx_position", columnList = "position_group_id ASC, code ASC"),
    @Index(name = "PRIMARY", unique = true, columnList = "id ASC")
})

Any ideas? Thanks in advance!

Alex Mueller

unread,
Feb 1, 2018, 1:20:55 PM2/1/18
to jOOQ User Group
More information before I forgo upgrading to 3.10.4.

Many of the Jooq code-generated classes all have an "indexes = {}" section within @Table that my app does not have a reference. This is where all of my "Cannot find symbol" errors are originating. Do I need to reference some dependency within my build.sbt? Maybe "javax.persistence" % "persistence-api" % "1.0.2"?

Other errors are, "cannot find symbol" for "import org.jooq.Index;"

My Play app's build.sbt looks like the following.

import sbt.Keys._
version := "1.0"
scalaVersion := "2.11.7"
val jooqVersion = "3.10.4"

val appDependencies = Seq(
  cache,
  javaWs,
  javaJdbc,
  javaJpa,
  "mysql" % "mysql-connector-java" % "5.1.44",
  "org.jooq" % "jooq" % jooqVersion,
  "org.jooq" % "jooq-meta" % jooqVersion,
//  "org.jooq" % "jooq-scala" % jooqVersion,
  "org.jooq" % "jooq-codegen" % jooqVersion,
  "be.objectify"  %% "deadbolt-java"     % "2.5.0",
  "be.objectify"  %% "deadbolt-core"     % "2.4.3",
  // Comment the next line for local development of the Play Authentication core:
  // https://github.com/joscha/play-authenticate
  "com.feth" %% "play-authenticate" % "0.8.3",
  // https://github.com/joscha/play-easymail
  "com.feth" %% "play-easymail" % "0.8.1",
  "com.google.code.gson" % "gson" % "2.6.2",
  "org.mindrot" % "jbcrypt" % "0.3m",
  "org.easytesting" % "fest-assert" % "1.4" % "test",
  "org.seleniumhq.selenium" % "selenium-java" % "2.52.0" % "test",
  "org.apache.poi" % "poi" % "3.14",
  "org.apache.poi" % "poi-ooxml" % "3.14",
  "org.ocpsoft.prettytime" % "prettytime" % "4.0.0.Final",
  "org.webjars" %% "webjars-play" % "2.5.0",
  "org.webjars" % "bootstrap" % "3.3.6",
  "org.webjars" % "jquery" % "2.2.4",
  "org.webjars" % "bootstrap-multiselect" % "0.9.13",
  "org.webjars.bower" % "lodash" % "4.9.0" exclude("org.webjars.bower", "jquery"),
  "org.webjars.bower" % "ion-range-slider" % "2.1.4" exclude("org.webjars.bower", "jquery"),
  "org.webjars" % "jquery-validation" % "1.15.0",
  "org.webjars" % "toastr" % "2.1.2",
  "org.webjars" % "datatables" % "1.10.11",
  "org.webjars" % "datatables-plugins" % "1.10.11-2",
  "net.gpedro.integrations.slack" % "slack-webhook" % "1.2.1"
)

Lukas Eder

unread,
Feb 2, 2018, 8:37:33 AM2/2/18
to jooq...@googlegroups.com
Hi Alex,

Thanks for your message. Indeed, there had been a breaking change for some people in jOOQ 3.10.0, which got fixed in 3.10.2. We've introduced support for this annotation with 

... without taking into account the JPA version. The @Index annotation was added in JPA 2.1. With the fix in 3.10.2, we've added a possibility of configuring the target JPA version for generated annotations:

Use <jpaVersion>1.0</jpaVersion> to fall back to the previous generation output.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Mueller

unread,
Feb 15, 2018, 9:31:03 AM2/15/18
to jOOQ User Group
Lukas,

Thanks. I took a look at this issue again last night for my local code. I am not seeing why I am seeing why I am getting "cannot find symbol" errors for class Index in package org.jooq when I have that referenced in my build.sbt when my play app runs. My steps are simple. Upgrade from Jooq 3.7 to 3.10.4, build my data layer with code generation, and run the app. The jpaVersion xml element is not available until 3.11 (from the XSD's I have seen online). org.jooq.Index is referenced in org.jooq:jooq:3.10.4:jar. I believe it should be available and discoverable.

Thanks for any help,

Alex

Lukas Eder

unread,
Feb 15, 2018, 11:08:27 AM2/15/18
to jooq...@googlegroups.com
Hi Alex,

You're right, I'm sorry - my bad. I should have followed through on the merge ticket for this fix. It was not merged to 3.10.x:

So, the jpaVersion element is available only from jOOQ 3.11 onwards.

I can see 4 workarounds:

- Turn off the generation of JPA annotations entirely
- Upgrade your compile time dependency to JPA 2.1 or 2.2
- Post-process the generated output to remove the index attribute on the annotations again
- Patch the code generator to remove the generation of the index attribute

Thanks,
Lukas

--
Reply all
Reply to author
Forward
0 new messages