- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经完成了我的代码,就像在谷歌的例子中一样。我试图建立一对一的关系。但我收到错误:AnnotationException 引用的属性不是 (One|Many)ToOne
问题 : 怎么了?
@Entity
@Table(name = "filesInfo")
@Inheritance(strategy= InheritanceType.JOINED)
public class FileInfo {
@Id
@SequenceGenerator(name = "file_info_sequence", sequenceName = "sq_file_info")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "file_info_sequence")
@Column(name = "id")
private long fileID;
@JsonIgnore
@OneToOne(mappedBy="fileInfo", cascade=CascadeType.ALL, fetch = FetchType.LAZY)
private FileContent fileContent;
//......
}
@Entity
@Table(name="file_content")
public class FileContent{
@Id
@Column(name="id", unique=true, nullable=false)
@GeneratedValue(generator="gen")
@GenericGenerator(name="gen", strategy="foreign", parameters=@Parameter(name="property", value="fileInfo"))
private long fileID;
@JsonIgnore
@PrimaryKeyJoinColumn
private FileInfo fileInfo;
//....
}
最佳答案
答案是在 FileContent.fileInfo 字段中添加 @OneToOne 注释。
关于 hibernate 一对一 : AnnotationException Referenced property not a (One|Many)ToOne,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17971192/
我对 OneToMany 注释有疑问 @Entity @Table(name = "RESULT_HISTORY") public class ResultHistoryImpl implements
我正在尝试用元素制作购物车。一个用户有多个项目,所以我这样做:我有一个 @Entity @Table 类 Item,它实现了 Serialized private User user; ... @Id
mvn clean install 工作正常,没有任何错误,但是当我启动 tomcat6 时,出现以下错误: 原因: org.hibernate.AnnotationException: Use of
我正在尝试使用 DoctrineMongoDBBundle,但是,我遇到了问题。 在我的 config.yml 中,我有: doctrine_mongodb: connections:
他似乎在通信代码中添加了@OneToMany和@ManyToOne,但由于某种原因,在启动Spring应用程序时出现错误. 类(class)客户: import com.fasterxml.jacks
我试图建立一对一的关系。但我得到错误: AnnotationException Referenced property not a (One|Many)ToOne on com.student.inf
我正在尝试使用注释进行一对一关系。 这是代码。 package test.hibernate; @Entity @Table(name="EMPLOYEE") public class Employe
我使用Spring Boot 2.0.0.RC1,Hibernate最新版本。文件persistence.xml com.donhuvy.entity.SysReportL
我正在尝试从 Hibernate 实体生成 sql 模式。这是我的实体: 学生实体 @Entity @Table(name = "address") public class Address {
我是 Spring-Hibernate 技术的新手,在将 Spring MVC 与 Hibernate 集成以处理两个类的关系时面临问题。下面是代码: 用户类: package com.MVCHibe
我有一个 groovy 实体 ClientInvoiceAttachmentExt,它扩展了 java 实体 ClientInvoiceAttachment。 ClientInvoiceAttachm
我需要建立一对多关系,但出现此错误mappedBy 引用了一个未知的目标实体属性这是父 Caused by: org.hibernate.AnnotationException: mappedBy r
我正在开始一个新项目,这是我第一次使用 Hibernate 4 并在没有 hibernate 模板的情况下使用 Spring 3。 这是我的两个实体类:(这似乎发生在所有实体类上) /** * Tw
我正在尝试在包级别创建一个 @GenericGenerator 注释,以便包中的所有实体都可以使用它。 1)我有一个带有注释的 package-info.java 类: @org.hibernate.
我已经完成了我的代码,就像在谷歌的例子中一样。我试图建立一对一的关系。但我收到错误:AnnotationException 引用的属性不是 (One|Many)ToOne 问题 : 怎么了? @Ent
我已经看到很多关于同一论点的问题,但我没有找到任何解决方案。我有两个继承同一个类的类。 基本上: @MappedSuperclass public abstract class MyGeneric {
我想在hibernate中进行一对多映射,但它显示异常,我尝试了很多但找不到解决方案 我有下面两张表 部门 deptno -- 数字主键 dname -- varchar2(10) loc -- va
我尝试使用 springboot、hibernate 和 mysql 运行休息服务器,但是当我运行它时出现以下错误: [main] ERROR org.springframework.boot.Spr
嗨,我刚刚创建了一个应用程序,它通过一对一映射保存表中的数据 每当我尝试将数据保存在表中时,我都会收到以下错误。 `Exception in thread "main" org.hibernate.A
我有以下配置: org.hibernate
我是一名优秀的程序员,十分优秀!