问题描述
code> javax.persistence.PersistenceException:java.lang.IllegalStateException:类[class play.db.ebean.Model]是增强的,[class models.User]不是 - (你不能混合!!)
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)
在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.serve (c)内部配置。 .ebeaninternal.server.core.DefaultServerFactory.createServer $($)并发现对于某些人来说,
编辑buils.scala在主要帮助中添加以下行:ebeanEnabled:= true
对我来说,它没有关闭ide运行播放清洁编译
任何想法?
解决方案是也提到它(> 15.5.2 javaagent 部分),甚至还有一个配置Eclipse的例子。
另外,要加快增强,可能会更好:
-javaagent:/path/to/ebean/ebean-2.7.3-agent.jar; packages = models。*
所以它只会查看
模型。*
(Play中的ORM模型的默认包)。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 peopleediting 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???
解决方案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:
-javaagent:/path/to/ebean/ebean-2.7.3-agent.jar
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:
-javaagent:/path/to/ebean/ebean-2.7.3-agent.jar;packages=models.*
So it will only look into
models.*
(default package for ORM models in Play).这篇关于播放框架2.1 junit测试不工作从日食的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!