2015-04-06 64 views
0

我是新來Ebean,並希望進行簡單設置,使用Spring 4,Ebean 4.5.5,在Wildfly 8.運行Ebean:豆未增強的錯誤

目前有一類org.test.models 。用戶,其具有註釋@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? 

回答

0

我已經在錯誤的loc中實現了插件(在<pluginManagement>標籤內)。根據this answer我安排我的插件是這樣的:

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