1

我有带有id注释的字段的实体@Id

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

@Entity
@Table(name = "orders")
@Data
@SuperBuilder
@NoArgsConstructor
public class Order {

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Long id;
}

当我使用mvn mn:run. 但是,如果使用构建应用程序mvn package -Dpackaging=native-image然后运行构建的应用程序,我会收到一个错误:

org.hibernate.AnnotationException: No identifier specified for entity: Order

micronaut 版本:2.3.4,micronaut 数据版本:2.2.4

4

1 回答 1

0

尝试将路径添加到 pom.xml

<path>
   <groupId>io.micronaut</groupId>
   <artifactId>micronaut-graal</artifactId>
   <version>${micronaut.version}</version>
</path>

添加龙目岛时

于 2021-11-09T11:17:02.450 回答