ebean常用问题

问题一:ebean的实体类is not an enhanced entity bean

原因:ebean默认解析的是models包,我用的是model,所以出错

原因二:插件安装但没有开启插件,configure-->enable ebean enhancer

 网上说明:Ensure application.conf has the ebean package configured for your datasource: ebean.default=["models.*"]

解决方法:

方法1.在mavan中安装插件

方法2.eclipse或者ide安装ebean的插件(参考地址:http://ebean-orm.github.io/docs/getting-started/

我使用的是sts,用插件安装的方式解决

插件安装地址:http://ebean-orm.github.io/eclipse/update

 步骤一:Help > Install new software

步骤二:Project > Enable Ebean enhancer

看日志:Window > Show view > Other > Error log

maven插件(网上的,只可参考)

    <dependencies>
        <dependency>
            <groupId>org.avaje.ebeanorm</groupId>
            <artifactId>avaje-ebeanorm-agent</artifactId>
            <version>4.5.1</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>process-classes</phase>
                        <configuration>
                            <tasks>
                                <property name="compile_classpath" refid="maven.compile.classpath" />
                                <echo message="Ebean enhancing test classes debug level -----------------------------------" />
                                <echo message="Classpath: ${compile_classpath}" />
                                <taskdef name="ebeanEnhance" classname="com.avaje.ebean.enhance.ant.AntEnhanceTask" classpath="${compile_classpath}" />
                                <ebeanEnhance classSource="${project.build.directory}/classes" packages="pl.euroimpex.**" transformArgs="debug=1" />
                            </tasks>
                            <encoding>UTF-8</encoding>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

猜你喜欢

转载自blog.csdn.net/zhaofengdeng/article/details/81391749