com.brightback.oss:ebean-guice

Parent pom for oss projects

License

License

Categories

Categories

GUI User Interface Guice Application Layer Libs Dependency Injection Ebean Data ORM
GroupId

GroupId

com.brightback.oss
ArtifactId

ArtifactId

ebean-guice
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Parent pom for oss projects
Source Code Management

Source Code Management

https://github.com/brightback/ebean-guice

Download ebean-guice

How to add to project

<!-- https://jarcasting.com/artifacts/com.brightback.oss/ebean-guice/ -->
<dependency>
    <groupId>com.brightback.oss</groupId>
    <artifactId>ebean-guice</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.brightback.oss/ebean-guice/
implementation 'com.brightback.oss:ebean-guice:0.0.1'
// https://jarcasting.com/artifacts/com.brightback.oss/ebean-guice/
implementation ("com.brightback.oss:ebean-guice:0.0.1")
'com.brightback.oss:ebean-guice:jar:0.0.1'
<dependency org="com.brightback.oss" name="ebean-guice" rev="0.0.1">
  <artifact name="ebean-guice" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.brightback.oss', module='ebean-guice', version='0.0.1')
)
libraryDependencies += "com.brightback.oss" % "ebean-guice" % "0.0.1"
[com.brightback.oss/ebean-guice "0.0.1"]

Dependencies

compile (6)

Group / Artifact Type Version
io.ebean : ebean jar 11.39.1
io.ebean : querybean-generator jar 11.39.2
io.ebean : ebean-querybean jar 11.39.1
com.google.inject : guice jar 4.2.2
com.google.guava : guava jar 28.0-jre
org.slf4j : slf4j-api jar 1.7.26

provided (2)

Group / Artifact Type Version
javax.persistence : persistence-api jar 1.0.2
com.h2database : h2 jar 1.4.199

Project Modules

There are no modules declared in this project.

EBean module for Guice

This is based on the ninja-ebean-ng module for Ninja Framework. EBean is a simple and powerful ORM tool. This module allows you to use EBean with Guice, and removes the Ninja dependencies of its predecessors.

Setup

  1. This assumes you have a binding or provider for your implementation of EbeanProperties, which supplies the configuration for EBean.

  2. There is a convenience in EBeanProperties that allows you to pass a java.util.Properties object conforming to the following property names:

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

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 ebean-guice dependency to your pom.xml:

    <dependency>
        <groupId>com.brightback.oss</groupId>
        <artifactId>ebean-guice</artifactId>
        <version>0.0.1</version>
    </dependency>
    
  2. Add ebean's enhancer plugin to your pom.xml:

    <plugin>
      <groupId>io.ebean</groupId>
      <artifactId>ebean-maven-plugin</artifactId>
      <version>${ebean.version}</version>
      <executions>
        <execution>
          <id>ebean-enhancer</id>
          <phase>process-classes</phase>
          <configuration>
            <classSource>${project.build.outputDirectory}</classSource>
            <packages>models</packages>
            <transformArgs>debug=1</transformArgs>
          </configuration>
          <goals>
            <goal>enhance</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    
  3. Install the module:

    @Override
    public void configure() {
        install(new EbeanModule());
    }
    
  4. Specify a provider for EbeanProperties:

    // Simple System.getProperties example:
    @Provides
    public EbeanProperties getEbeanProperties() {
        return EbeanProperties.fromProperties(System.getProperties());
    }
    
    // Named Java Properties example:
    @Provides
    public EbeanProperties getEbeanProperties(@Named("ebean.properties") Properties props) {
        return EbeanProperties.fromProperties(props);
    }
    
    // Ninja example:
    @Provides
    public EbeanProperties getEbeanProperties(NinjaProperties props) {
        return EbeanProperties.fromProperties(props.getAllCurrentNinjaProperties());
    }
    
    // Provide your own!
    @Provides
    public EbeanProperties getEbeanProperties() {
        return new MyEbeanProperties();
    }
    
com.brightback.oss

Brightback.com

Versions

Version
0.0.1