JVM Languages


You can use Ebean with Groovy classes. There is nothing special you need to do. Just annotate your groovy beans with the JPA annotations.

//GROOVY CODE (generates the getters and setters etc)
package test
import javax.persistence.*;

public class PersonG{
  Integer id

  String name

  List<Topic> topics;
You can use Ebean just as you would in Java.
package test

import com.avaje.ebean.*

public class MainEbean{
  public static void main(String[] args) {

    PersonG g = Ebean.getReference(PersonG.class, 1);

    String name = g.getName();

    List<PersonG> list = Ebean

    println "Got list "+list

    list.each() {
      print " $\{it.id} $\{it.name} \n"
      print " GOT DETAILS: "+it.topics

    println "done";

Note that if you want more groovy integration please make some suggestions of what you would like to see.


You can use Ebean with Scala as well. Again, annotate your scala “bean” with the JPA annotations as you would normally.

In May 2010 Ebean 2.6.0 was released which included support for Scala 2.8. That meant you could use Scala Option and mutable collection types (Scala 2.8 mutable Buffer, Set and Map) in your entity beans rather than the java collection types (so pretty much have your entity beans written in Scala).

In Oct 2012 the Scala support was removed from the code base. This was because :

  • It was becoming a pain to maintain (incompatible changes between scala versions) and it was increasingly hard to convert Scala types back to matching java ones to call JDBC etc.
  • There was very little uptake
  • No one in the community championed the Scala support

If anyone is interested in championing Scala support, the old code would be in source history on github.