Heys guys,
I hope you can really help me with subprojects in Play Framework 2.4.x. I'm developing a Play project (I call it root) with a subproject. Both do have ebean models and I want to save these models in different databases. I tried many possibilies but I'm not able to work it out.
- Defining a database and the Ebean configuration in the [root]/conf/application.conf and the other one in [root]/modules/sub/conf/application.conf (with different database names). Then I get an error "CreationException: Unable to create injector, see the following errors: 1) Error injecting constructor, java.lang.IllegalStateException: Bean class models.RootModel is not enhanced?"
 - Defining one database and the Ebean configuration in root's configuration and one in the subproject's configuration with the same database name. Then I get an error "PersistenceException: subproject.models.SubModel is NOT an Entity Bean registered with this server?"
 - Defining both databases and Ebean configuration in the root project and define the database for the subproject in its configuration, same error like in 1.
 - No configuration in my subproject, error: "CreationException: Unable to create injector, see the following errors: 1) Error injecting constructor, java.lang.IllegalStateException: Bean class subproject.models.SubModel is not enhanced?"
 
How do I setup the databases for my Play Framework project and its subproject?
My files are in these folders:
    [root]/build.sbt
    [root]/conf/application.conf
    [root]/app/models/RootModel.java
    [root]/modules/sub/conf/application.conf
    [root]/modules/sub/conf/app/models/subproject/models/SubModel.java
My [root]/build.sbt:
    import com.typesafe.play.sbt.enhancer.PlayEnhancer
    name := """rootproject"""
    version := "1.0"
    lazy val root = (project in file("."))
        .enablePlugins(PlayJava, PlayEbean, PlayEnhancer)
        .aggregate(sub)
        .dependsOn(sub) 
        .settings(
            TwirlKeys.templateImports += "subproject.models._"
         )
     lazy val sub = project.in(file("modules/sub"))
        .enablePlugins(PlayJava, PlayEbean, PlayEnhancer)
     scalaVersion := "2.11.6"
Defining of the database and ebean configuration in the application.conf:
    db.default.driver=org.h2.Driver
    db.default.url="jdbc:h2:./db/default;DB_CLOSE_DELAY=-1"
    db.default.username="sa"
    db.default.password="..."
    db.sub.driver=org.h2.Driver
    db.sub.url="jdbc:h2:./db/sub;DB_CLOSE_DELAY=-1"
    db.sub.username="sa"
    db.sub.password="..."
    ebean.default=["models.*"]
    ebean.sub=["subproject.models.*"]