我在电影服务的数据库中设计了一个表系统。到目前为止,我已经以这种方式设计了它们。
@Entity
@Table(name = "movies")
@Data
public class MovieEntity {
@Id
@Column(unique = true, updatable = false)
@GeneratedValue
private Long id;
@OneToMany(mappedBy = "movie", cascade = CascadeType.ALL)
private Set<MovieDescription> description;
}
@Entity
@Table(name = "movies_info")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type")
public abstract class MovieInfo {
@Id
@Column(unique = true, updatable = false)
@GeneratedValue
private Long id;
@ManyToOne
public MovieEntity movie;
}
@Entity
@DiscriminatorValue(value = EditType.Values.DESCRIPTION)
public class MovieDescription extends MovieInfo {
private String description;
private String language;
}
编译时,它给我发错了
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.core.jpa.entity.MovieDescription.movie in com.core.jpa.entity.MovieEntity.description
与MovieEnity映射有关的东西,但我不知道它是什么。
答案 0 :(得分:0)
使用targetEntity属性来定位要映射的超类字段。
/give @p stick 1 0 {ench:[{"id":3,"lvl":3}]}