Ebean:Bean没有增强错误

时间:2015-04-06 06:49:16

标签: java ebean

我是Ebean的新手,想要在Wildfly 8上运行Spring 4,Ebean 4.5.5轻松设置。

目前有一个类org.test.models.User,它有注释@Entity@Table(name="user")

我的ebean.properties如下所示:

ebean.classes=org.test.models.User

ebean.debug.sql=true  
ebean.debug.lazyload=false  
ebean.logging=all  

ebean.logging.logfilesharing=all  

ebean.logging.directory=${catalina.base}/logs/trans  

ebean.logging.iud=sql  
ebean.logging.query=sql  
ebean.logging.sqlquery=sql  

ebean.logging.txnCommit=none  

datasource.default=mysql

datasource.mysql.username=ebeanuser  
datasource.mysql.password=123456
datasource.mysql.databaseUrl=jdbc:mysql://localhost/ebeantest
datasource.mysql.databaseDriver=com.mysql.jdbc.Driver  
datasource.mysql.minConnections=1  
datasource.mysql.maxConnections=25  
#datasource.mysql.heartbeatsql=select 1  
datasource.mysql.isolationlevel=read_committed  

ebean.ddl.generate=true  
ebean.ddl.run=true

我知道我需要增强实体,因此包含了mavenenhancer插件:

<plugin>
 <groupId>org.avaje.ebeanorm</groupId>
 <artifactId>avaje-ebeanorm-mavenenhancer</artifactId>
 <version>4.5.2</version>
 <executions>
 <execution>
 <id>main</id>
 <phase>process-classes</phase>
 <goals>
 <goal>enhance</goal>
 </goals>
 <configuration>
 <packages>org.test.**</packages>
 <transformArgs>debug=9</transformArgs>
 <classpath>${project.build.outputDirectory}</classpath>
 <classSource>${project.build.outputDirectory}</classSource>
 <classDestination>${project.build.outputDirectory}</classDestination>
 </configuration>
 </execution>
 </executions>
</plugin>

调用Ebean.save(user)时,我得到例外:

22:47:27,401 ERROR [com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager] (default task-2) Error in deployment: java.lang.IllegalStateException: Bean class org.test.models.User is not enhanced?

1 个答案:

答案 0 :(得分:0)

我在错误的位置(<pluginManagement>标记内)实现了插件。根据{{​​3}}我安排了我的插件:

<plugins>
   <!-- mavenenhancer plugin here -->
</plugins>
<pluginManagement>
   <plugins>
       <!-- lifecycle-mapping to ensure, eclipse runs mavenenhancer only if needed -->
   </plugins>
</pluginManagement>