I've been using Groovy with ObjectDb, just thought I'd post a short snippet to show how easy this is to do.
The following script (which is one import and one statement) will open a database, run a query and print some results.
---------------------------------------------------------------
import javax.persistence.Persistence Persistence .createEntityManagerFactory ("../db1.odb") .createEntityManager() .createQuery ("SELECT u FROM User u") .getResultList() .each { println it }