1

我一直在尝试使用使用org.immutablesas hibernate生成的类@Entity。但是,我不断得到Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.service.AbstractUserEntity

我的实体定义


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

@Entity
@Table(name = "USER", schema = "public")
@Value.Style(passAnnotations = {Access.class, Id.class, Entity.class, Table.class}, typeImmutable="*")
@Value.Immutable
public abstract class AbstractUserEntity  {
    @Id
    @Access(AccessType.PROPERTY)
    public abstract String id();
    public abstract String name();
    public abstract String picture();
}

库版本


        <dependency>
            <groupId>org.immutables</groupId>
            <artifactId>value</artifactId>
            <version>2.8.2</version>
            <scope>provided</scope>
        </dependency>
        dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.4.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.8</version>
        </dependency>

有没有人遇到过这个?或者有人可以指出我错过了什么?

4

0 回答 0