Related: Trouble Shooting

Query bean generation with Maven

We can optionally add a Java annotation processor (APT) to generate query beans. This allows us to write type safe queries like:

List<Customer> customers =
  new QCustomer()

Skip this if you don't want to use query beans.

Add ebean-querybean dependency

<dependency org="io.ebean" name="ebean-querybean" rev="${version}"/>
  @Grab(group='io.ebean', module='ebean-querybean', version='${version}')
libraryDependencies += "io.ebean" % "ebean-querybean" % "${version}"
[io.ebean/ebean-querybean "${version}"]

Java APT

To generate Java query beans with maven add provided scope dependency for querybean-generator

<!-- annotation processor to generate query beans -->
Example project

Full example pom with query bean generation

Kotlin KAPT

To generate Kotlin query ebeans add the kotlin-kapt maven tile.

This tile brings in the kotlin-maven-plugin with configuration for kotlin-querybean-generator annotation processor. As such remove the kotlin-maven-plugin that will already be in the pom.xml (as the tile will bring in one that is configured to run the annotation processor).

Add the maven tile into the build / plugins section of the pom.xml.

      <tile>io.ebean.tile:enhancement:7.4</tile> <!-- ebean enhancement -->
      <tile>io.ebean.tile:kotlin-kapt:1.5</tile> <!-- kotlin compile with query bean generation -->
      <!-- other tiles ... -->
Example project

Full example pom for Kotlin query bean generation

Edit Page