[2.0] Ebean exception for model class in a Sub-project

492 views
Skip to first unread message

Ólafur Gauti Guðmundsson

unread,
Feb 18, 2012, 2:30:56 PM2/18/12
to play-framework
Hi everyone,
I'm writing an application that consists of a few parts which all run
as a separate web app, so multiple play projects.
However, they do share some common classes.

So I created a Play project called "common" for these classes. Among
the common classes is a model class.
This project now contains one class annotated as @Entity, extending
the "Model" class.

I've declared a dependency on the "common" project in Build.scala.

val common = PlayProject(
appName + "-common", appVersion, path = file("modules/
myapp_common")
)

val main = PlayProject(appName, appVersion, appDependencies,
mainLang = JAVA).settings(
// Add your own project settings here
).dependsOn(common)

The main project also has some model classes of its own.

However, when I start up the main Play project, I always get the
following error:

play.api.UnexpectedException: Unexpected exception
[PersistenceException: Error with [models_common.Vendor] It has not
been enhanced but it's superClass [class play.db.ebean.Model] is? (You
are not allowed to mix enhancement in a single inheritance hierarchy)
marker[play.db.ebean.Model] className[models_common.Vendor]]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$
$anonfun$1.apply(ApplicationProvider.scala:134) ~[play_2.9.1.jar:2.0-
RC2]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$
$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0-
RC2]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply
$3.apply(ApplicationProvider.scala:112) ~[play_2.9.1.jar:2.0-RC2]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply
$3.apply(ApplicationProvider.scala:110) ~[play_2.9.1.jar:2.0-RC2]
at scala.Either$RightProjection.flatMap(Either.scala:277) ~[scala-
library.jar:0.11.2]


Can anyone tell me what I am doing wrong?
Is it not supported to have model classes loaded from a referenced
project?

Thanks for your help!
Regards,
OGG

Guillaume Bort

unread,
Feb 18, 2012, 2:51:59 PM2/18/12
to play-fr...@googlegroups.com
set mainLang = JAVA or set this setting: ebeanEnabled := true

2012/2/18 Ólafur Gauti Guðmundsson <oli....@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>

--
Guillaume Bort

Ólafur Gauti Guðmundsson

unread,
Feb 18, 2012, 3:05:09 PM2/18/12
to play-framework
Great thanks, that did the trick, the exception no longer appears.

However, now I have another problem: I get "Action not found" when I
go to http://localhost:9000/.

The text "These routes have been tried, in this order:" appears, but
no routes are listed.

I have deleted all routes from the routes file in my "common" Play
project.

Is it possible that Play is ignoring the routes file of the main
project, and instead only looking at the routes file of the referenced
"common" project?
Can I modify this behavior in any way?

Thanks again for the quick reply, and your continued help!

Regards,
OGG

On Feb 18, 7:51 pm, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> set mainLang = JAVA or set this setting: ebeanEnabled := true
>
> 2012/2/18 Ólafur Gauti Guðmundsson <oli.ga...@gmail.com>:

Guillaume Bort

unread,
Feb 18, 2012, 3:12:11 PM2/18/12
to play-fr...@googlegroups.com
Yes that's the current problem with routes defined in sub projects. Delete the routes file (and application.conf) fir the subproject.

Ólafur Gauti Guðmundsson

unread,
Feb 18, 2012, 3:18:39 PM2/18/12
to play-framework
Great, all good now!
Thanks again :)

-OGG

On Feb 18, 8:12 pm, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Yes that's the current problem with routes defined in sub projects. Delete the routes file (and application.conf) fir the subproject.
>
> On 18 févr. 2012, at 21:05, Ólafur Gauti Guðmundsson <oli.ga...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Great thanks, that did the trick, the exception no longer appears.
>
> > However, now I have another problem: I get "Action not found" when I
> > go tohttp://localhost:9000/.
Reply all
Reply to author
Forward
0 new messages