Configuring BasePlugin / Database specifics

If Ebean is not recognising your specific Database you will want to configure it. You can either configure the BasePlugin through system.properties or build a specific "Plugin Class" that extends BasePlugin.

 

The configuration questions you will have to answer are:
Q: What are the quoted identifier strings?
The default is double quotes.
Q: Does this Database use Sequences or Identity/Autoincrement?
If it supports neither an External Id Generator must be used.
Q: Does this Database support getGeneratedKeys?
If this is not supported then you can not use statement batching transparently. Things are doable but certainly not as nice. If you have a requirement for large batch inserts then I would look closely at how you will be restrcited by this.
Q: Does this Database support ROW_NUMBER() or LIMIT or neither for limiting resultsets?
Refer to this excellent url. http://troels.arvin.dk/db/rdbms/#select-limit

 

Configure BasePlugin via system.properties

You can configure the BasePlugin by using system.properties

Assuming my database name is "mydb" then I could put these entries into the system.properties file.


ebean.mydb.openquote=]
ebean.mydb.closequote=[

ebean.mydb.supportsGetGeneratedKeys=true
ebean.mydb.supportsSequences=false

# Default to use DB Identity/AutoIncrement, 
#   DB Sequence or External Id Generator
#
# identity, sequence, generator
ebean.mydb.identityGeneration=identity


# Limit resultsets by ROW_NUMBER() LIMIT or jdbc resultset navigation
#
# rownumber, limit, jdbc
ebean.mydb.resultSetLimit=jdbc

Building a Plugin (Extend BasePlugin)

Have a look at the code in com.avaje.ebean.server.plugin

Its fairly straight forward to build a plugin and this is the Oracle10 specific plugin code.


public class Oracle10Plugin extends BasePlugin {

    public Oracle10Plugin() {
        super();
        setPropertyDefault("namingconvention.sequence.nextvalsuffix", ".NEXTVAL");
        setPropertyDefault("namingconvention.sequence.from", "FROM DUAL");
       
        this.supportsGetGeneratedKeys = true;
        this.supportsSequences = true;
        
        this.openQuote = "\"";
        this.closeQuote = "\"";
        this.resultSetLimit = ResultSetLimit.RowNumber;

    }

}

In system.properties specify your plugin implementation for "mydb"


# Specify a specific Plugin
#
ebean.mydb.plugin=com.avaje.ebean.server.plugin.MySpecificPlugin

Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements
woResponse