im following the zentask tutorial and wrote a junit test, the test wont run from the eclipse IDE its giving the following exception
javax.persistence.PersistenceException: java.lang.IllegalStateException: Class [class play.db.ebean.Model] is enhanced and [class models.User] is not - (you can not mix!!)
at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.setEntityBeanClass(BeanDescriptorManager.java:1475)
at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.createByteCode(BeanDescriptorManager.java:1138)
at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readDeployAssociations(BeanDescriptorManager.java:1058)
at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readEntityDeploymentAssociations(BeanDescriptorManager.java:565)
at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.deploy(BeanDescriptorManager.java:252)
at com.avaje.ebeaninternal.server.core.InternalConfiguration.<init>(InternalConfiguration.java:124)
at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:210)
at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:64)
I read a bit and found that for some people editing the buils.scala adding the following line inside main helped : ebeanEnabled := true
to me it didnt nither closeing the ide running play clean compile
any ideas???
You can use the Avaje Ebean Eclipse Plugin:
http://www.avaje.org/eclipseupdate/site.xml
After the installation, activate Ebean enhancement by right clicking on your project and selecting Enable Ebean Enhancement.
i got this error when i tried to remove the public modifier from the declaration of one of classes extending Model.
i was using a model to make a "through" table (a many to many relationship with additional information), so protected access makes sense. perhaps there's another way to do this, but the play javadoc is pretty sparse.
There is blog post about setting up unit tests to run in IDEs. It suggests to add following command-line to java used when running tests:
Seems that Play not ships with ebean agent, it should be downloaded from Ebean website first (in main ebean package).
I not tried it.
Ebean user guide also mentions it (15.5.2 javaagent section), there is even example for configuring Eclipse.
Also, to speed up enhancement maybe this will be better:
So it will only look into
models.*
(default package for ORM models in Play).