【问题标题】:EBean enhancement issue [POJO not enhanced]EBean 增强问题 [POJO 未增强]
【发布时间】:2020-04-15 15:35:13
【问题描述】:

我将 Ebean 和 Vert.x 用于我的 cron 作业。

但由于某些原因,实体没有被 ebean-maven-plugin 增强。

这是我正在使用的:

              <plugin>
                <groupId>io.ebean</groupId>
                <artifactId>ebean-maven-plugin</artifactId>
                <version>12.1.12</version>
                <executions>
                    <execution>
                        <id>main</id>
                        <phase>process-classes</phase>
                        <configuration>
                            <transformArgs>debug=1</transformArgs>
                        </configuration>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

我的实体:

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "targeting_locations")
public class TargetingLocations {

    @Id
    @Column(name = "id")
    public Long id;
// other properties

}

这是错误代码:

2020-04-15 19:39:26,671  i.e.s.d.BeanDescriptorManager - Error in deployment
java.lang.IllegalStateException: Bean class com.xxx.model.TargetingLocations is not enhanced?
    at io.ebeaninternal.server.deploy.BeanDescriptorManager.setEntityBeanClass(BeanDescriptorManager.java:1414)
    at io.ebeaninternal.server.deploy.BeanDescriptorManager.createByteCode(BeanDescriptorManager.java:1286)
    at io.ebeaninternal.server.deploy.BeanDescriptorManager.readDeployAssociations(BeanDescriptorManager.java:1208)
    at io.ebeaninternal.server.deploy.BeanDescriptorManager.readEntityDeploymentAssociations(BeanDescriptorManager.java:711)

从不同的帖子中,无法真正找出导致此问题的原因。

【问题讨论】:

    标签: vert.x ebean


    【解决方案1】:

    您的域应该扩展 io.ebean.Model 休息看起来不错。

    【讨论】:

      【解决方案2】:

      您好,我最近遇到了同样的问题,我从ebean-maven-plugin 更改为tiles-maven-plugin。它将增强您的 Ebean 实体。这是插件:

              <plugin>
                  <groupId>io.repaint.maven</groupId>
                  <artifactId>tiles-maven-plugin</artifactId>
                  <version>2.10</version>
                  <extensions>true</extensions>
                  <configuration>
                      <tiles>
                          <tile>org.avaje.tile:java-compile:1.1</tile>
                          <tile>io.ebean.tile:enhancement:5.3</tile>
                      </tiles>
                  </configuration>
              </plugin>
      

      通过使用tiles-maven-plugin,你只需要这个ebean依赖:

          <dependency>
              <groupId>io.ebean</groupId>
              <artifactId>ebean</artifactId>
              <version>11.22.4</version>
          </dependency>
      

      希望对您有所帮助。谢谢。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-13
        • 1970-01-01
        相关资源
        最近更新 更多