[2.0] Project play-scala and Ebean

5,124 views
Skip to first unread message

Miuler

unread,
Mar 17, 2012, 9:58:49 AM3/17/12
to play-fr...@googlegroups.com
Hi, i have a problem:

PersistenceException: Error with [models.Persona] 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.Persona]
No source available, here is the exception stack trace:
->javax.persistence.PersistenceException: Error with [models.Persona] 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.Persona]



app/models/Persona.java
package models;

import javax.persistence.Entity;

import play.db.ebean.Model;

@Entity
public class Persona extends Model {

  @Id
  public Long id;

  public String nombre;

}

application.conf
ebean.default="models.*"
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"



Freewind

unread,
Mar 17, 2012, 10:05:06 AM3/17/12
to play-fr...@googlegroups.com
Add this to `application.conf`:

    # Ebean
    # ~~~~~
    ebean.default = "models.*"

But ....

Don't use play2-scala with ebean, there are many issues because play2 don't enhance scala code as Java code. You will find a lot of strange things soon.

Miuler

unread,
Mar 17, 2012, 10:13:45 AM3/17/12
to play-fr...@googlegroups.com
already added  :'(  


application.conf
ebean.default="models.*"
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"

same problem:

PersistenceException: Error with [models.PersonaIt 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.Persona]




Freewind

unread,
Mar 17, 2012, 11:11:56 AM3/17/12
to play-fr...@googlegroups.com
I forget we should also add in Build.sbt:

  val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
    ebeanEnabled := true
  )

And you can also port my demo in github: https://github.com/freewind/play2_scala_ebean

You will see the `model can't be updated` issue of play2+scala+ebean

Miuler

unread,
Mar 17, 2012, 1:20:53 PM3/17/12
to play-fr...@googlegroups.com
masterly :D thanks

Zoro

unread,
Apr 18, 2012, 1:03:28 PM4/18/12
to play-framework
I have the same problem. I added ebeanEnabled := true to Build.scala
(i use JAVA), but it doesn't work for me.

Have any suggestions?

Log:

2012-04-18 21:00:29,959 - [INFO] - from play in main
Listening for HTTP on port 9000...

2012-04-18 21:00:35,980 - [INFO] - from play in play-
akka.actor.default-dispatcher-1
database [default] connected at jdbc:mysql://localhost/artengi

2012-04-18 21:00:37,345 - [ERROR] - from
com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager in play-
akka.actor.default-dispatcher-1
Error in deployment
javax.persistence.PersistenceException: Error with
[models.ParameterValue] 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.ParameterValue]
at
com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.setEntityBeanClass(BeanDescriptorManager.java:
1532) ~[ebean-2.7.3.jar:na]
at
com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.createByteCode(BeanDescriptorManager.java:
1204) ~[ebean-2.7.3.jar:na]
at
com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readDeployAssociations(BeanDescriptorManager.java:
1124) ~[ebean-2.7.3.jar:na]
at
com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readEntityDeploymentAssociations(BeanDescriptorManager.java:
630) ~[ebean-2.7.3.jar:na]
at
com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.deploy(BeanDescriptorManager.java:
277) ~[ebean-2.7.3.jar:na]
at
com.avaje.ebeaninternal.server.core.InternalConfiguration.<init>(InternalConfiguration.java:
150) [ebean-2.7.3.jar:na]
...

2012-04-18 21:00:37,353 - [ERROR] - from application in New I/O server
worker #1-1


! @6a4l61ck9 - Internal server error, for request [GET /] ->

play.api.UnexpectedException: Unexpected exception
[PersistenceException: Error with [models.ParameterValue] 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.ParameterValue]]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$
$anonfun$1.apply(ApplicationProvider.scala:134) ~[play_2.9.1-2.0.jar:
2.0]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$
$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.9.1-2.0.jar:
2.0]
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-2.0.jar:2.0]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply
$3.apply(ApplicationProvider.scala:110) ~[play_2.9.1-2.0.jar:2.0]
at scala.Either$RightProjection.flatMap(Either.scala:277) ~[scala-
library.jar:0.11.2]
...

On Mar 17, 9:20 pm, Miuler <miu...@gmail.com> wrote:
> masterly :D thanks
>
> El sábado 17 de marzo de 2012 10:11:56 UTC-5, Freewind escribió:
>
>
>
>
>
>
>
>
>
> > I forget we should also add in Build.sbt:
>
> >   val main = PlayProject(appName, appVersion, appDependencies, mainLang =
> > SCALA).settings(
> >     ebeanEnabled := true
> >   )
>
> > And you can also port my demo in github:
> >https://github.com/freewind/play2_scala_ebean
>
> > You will see the `model can't be updated` issue of play2+scala+ebean
>
> > On Saturday, March 17, 2012 10:13:45 PM UTC+8, Miuler wrote:
>
> >> already added  :'(
>
> >> *application.conf*
> >> ebean.default="models.*"
> >> db.default.driver=org.h2.Driver
> >> db.default.url="jdbc:h2:mem:play"
>
> >> same problem:
>
> >> *PersistenceException*: Error with [*models.Persona*] *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.Persona]
>
> >> El sábado 17 de marzo de 2012 09:05:06 UTC-5, Freewind escribió:
>
> >>> Add this to `application.conf`:
>
> >>>     # Ebean
> >>>     # ~~~~~
> >>>     ebean.default = "models.*"
>
> >>> But ....
>
> >>> Don't use play2-scala with ebean, there are many issues because play2
> >>> don't enhance scala code as Java code. You will find a lot of strange
> >>> things soon.
>
> >>> On Saturday, March 17, 2012 9:58:49 PM UTC+8, Miuler wrote:
>
> >>>> *Hi, i have a problem:*
>
> >>>> *PersistenceException*: Error with [*models.Persona*] *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.Persona]
> >>>> No source available, here is the exception stack trace:
> >>>> ->javax.persistence.PersistenceException: Error with [models.Persona]
> >>>> 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.Persona]
>
> >>>> *app/models/Persona.java*
> >>>> package models;
>
> >>>> import javax.persistence.Entity;
> >>>> import javax.persistence.Id;
>
> >>>> import play.db.ebean.Model;
>
> >>>> @Entity
> >>>> public class Persona extends Model {
>
> >>>>   @Id
> >>>>   public Long id;
>
> >>>>   public String nombre;
>
> >>>> }
>
> >>>> *application.conf*

Zoro

unread,
Apr 18, 2012, 1:44:08 PM4/18/12
to play-framework
I have the same problem as described here -> https://github.com/li-o/Play20Exceptions
I spent several days trying to solve it. It may be a bug in my code,
but I do not know where.
Appreciate any help.

Zoro

unread,
Apr 18, 2012, 2:57:12 PM4/18/12
to play-framework

Leonard Punt

unread,
Apr 18, 2012, 4:05:26 PM4/18/12
to play-fr...@googlegroups.com
Hi,


Your problem is:
- You have a class 'models.ParameterValue' which is not an entity (not annotated with @Entity).
- In your application.conf you have set the following parameter:
# Ebean configuration
# ~~~~~
# You can declare as many Ebean servers as you want.
# By convention, the default server is named `default`
#
ebean.default="models.*"

To fix your error you should either:
- Make an entity from your class 'models.ParameterValue'.
- Replace ebean.default="models.*" with ebean.default="models.Model1, models.Model2, etc."

Leonard

Op woensdag 18 april 2012 20:57:12 UTC+2 schreef Zoro het volgende:

Zoro

unread,
Apr 20, 2012, 8:51:50 AM4/20/12
to play-fr...@googlegroups.com
I have @Entity annotation. 

Replace ebean.default="models.*" with ebean.default="models.Model1, models.Model2, etc."  also didn't work for me.

I read all posts in thread https://groups.google.com/forum/#!msg/play-framework/Ojn4EcR6Yns/ga2ZYDys5mgJ . And at the end i found answer. Now this bug fixed in master branch. So i just building play from source.  https://github.com/playframework/Play20/wiki/BuildingFromSource And everything works fine.

Thanks.

Tex

unread,
Apr 25, 2012, 3:20:49 PM4/25/12
to play-fr...@googlegroups.com
Same problem here but I've solved with:

ebean.default="models.*.*"

Now it works but I don't know why...

Pavel Khandramay

unread,
Apr 25, 2012, 3:28:25 PM4/25/12
to play-fr...@googlegroups.com
I also tryed this. But in this case I was getting errors when trying
to save / load data. Since my model classes are in package models.* ,
not models.*.* Try save or load data. If it works, I'm happy for
you.

Helped me only the latest version of play-framework, obtained from the sources.
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/Lcj6nHDqxBoJ.
>
> 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.

Tex

unread,
Apr 30, 2012, 4:34:22 PM4/30/12
to play-fr...@googlegroups.com
@Zoro: u r right, I've the same problem during save / load data.

Like you the problem has gone building Play20 from github sources: https://github.com/playframework/Play20/wiki/BuildingFromSource

Guilherme Santos

unread,
Jun 30, 2012, 7:34:28 PM6/30/12
to play-fr...@googlegroups.com
Hello,

I've moved my models to a different package and it worked... but I don't know why!

cheers,

On Thursday, June 28, 2012 9:24:20 AM UTC+1, Guilherme Santos wrote:
Hi,

I've found Play only a few weeks ago and I'm enjoying it quite a lot.
Unfortunately I've been facing some issues and because of that, yesterday I decided to upgrade to version 2.0.2. Now I'm facing the PersistenceException nightmare :(

I tried to use the latest version, building Play20 from github but the problem persists.
Any suggestion?

I'm starting to be under heavy pressure. I've to deliver my web application tomorrow and since the beginning of the week that most of my time was spent on weird issues like this one :(

Thank you very much in advance.

Chinmay C

unread,
Feb 27, 2013, 11:19:33 PM2/27/13
to play-fr...@googlegroups.com
@Tex: Thanks. ebean.default="models.*.*" worked for me too
Reply all
Reply to author
Forward
0 new messages