Ebean ORM support for Ninja Framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ninja-ebean-demo
ninja-ebean-module
src/main/resources
.gitignore
.travis.yml
README.md
changelog.md
license.txt
pom.xml

README.md

 _______  .___ _______        ____.  _____   
 \      \ |   |\      \      |    | /  _  \  
 /   |   \|   |/   |   \     |    |/  /_\  \
/    |    \   /    |    \/\__|    /    |    \
\____|__  /___\____|__  /\________\____|__  /
     web\/framework   \/                  \/

Ebean support for Ninja

Ebean is a simple and powerful ORM tool. This plugin allows to use Ebean in any Ninja application.

More

Getting started

Configuring the module for your application is quite easy. There is a demo application that shows you how to do it. Check out subproject ninja-ebean-demo/pom.xml for further information.

More about Ebean: http://www.avaje.org

Overview

This module works with the latest versions of Ebean and it currently requires a minimum Ebean version of v6.16.4. Since this module more or less configures the Ebean server, it should be compatible with any Ebean release that continues to support current configuration properties.

If you need compatibility with earlier versions of Ebean please see v1.5.1 which supports a minimum Ebean version v3.2.5, and has also been tested with the later versions in the 4.x series.

NOTE: This module only supports a single (default) Ebean server. Feel free to contribute code to the project if you need other features. Thanks!

Setup

  1. Add your db conf to your application.conf file. For a simple H2 database:

    ebean.datasource.databaseUrl=jdbc:h2:testdatabase:tests;DB_CLOSE_DELAY=-1;AUTO_SERVER=TRUE

For a MySQL database (you'll also need to add the MySQL driver dependency to your project)

ebean.ddl.generate = false
ebean.ddl.run = false
ebean.models = com.company.models.*,org.otherorg.models.Foo
ebean.datasource.name = NameOfEbeanServer
ebean.datasource.databaseUrl = jdbc:mysql://localhost:3306/dbname
ebean.datasource.databaseDriver = com.mysql.jdbc.Driver
ebean.datasource.username = root
ebean.datasource.password = test

Please note that ebean.models accepts a comma delimited list of both class names as well as packages (just make sure it ends with .*)

  1. Add the ninja-ebeans dependency to your pom.xml:

    org.ninjaframework ninja-ebean-module 1.4.1
  2. Add ebean's enhancer plugin to your pom.xml:

    org.avaje.ebeanorm avaje-ebeanorm-mavenenhancer 4.7.1 ebean-enhancer process-classes ${project.build.outputDirectory} models debug=1 enhance
  3. Install the module in your conf.Module:

    protected void configure() {

     // This installs the NinjaModule and handles the lifecycle
     install(new NinjaEbeanModule());
    

    }

And that's it already :)