EBean/Hibernate OneToMany仅单向加载
我在使用Avaje Ebean的ORM映射时遇到了一个问题,其中只加载了多个关系,而没有加载一个 我有以下结构,一个使用单表继承的抽象类通知,实现类之一是ReportNotification。 它是一个包含许多通知的报表类。 当我运行代码时,我的报告将返回其所有通知,但我的通知从不加载报告。数据库看起来正确,表中的值也正确,因此我不确定我做错了什么。 我尝试过许多变体,但都没有成功 在通知表上的数据库中,出于某种原因,外键引用id被命名为report\u report\u id,但它是由Ebean以这种方式生成的EBean/Hibernate OneToMany仅单向加载,hibernate,orm,playframework,ebean,Hibernate,Orm,Playframework,Ebean,我在使用Avaje Ebean的ORM映射时遇到了一个问题,其中只加载了多个关系,而没有加载一个 我有以下结构,一个使用单表继承的抽象类通知,实现类之一是ReportNotification。 它是一个包含许多通知的报表类。 当我运行代码时,我的报告将返回其所有通知,但我的通知从不加载报告。数据库看起来正确,表中的值也正确,因此我不确定我做错了什么。 我尝试过许多变体,但都没有成功 在通知表上的数据库中,出于某种原因,外键引用id被命名为report\u report\u id,但它是由Ebea
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "notification_type", discriminatorType = DiscriminatorType.STRING)
public abstract class Notification extends Model {
@Id
@Column(unique = true)
public Long id;
然后我有两个实现类,但为了清楚起见,我只列出一个
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("REPORT")
public class ReportNotification extends Notification {
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="report_report_id", referencedColumnName = "report_report_id")
public Report report;
我有它参加的报告课
@Entity
public class Report extends Model {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "report_id")
public Long reportId;
@OneToMany(mappedBy = "report", targetEntity = ReportNotification.class)
public Set<ReportNotification> notifications;
}
您没有说明实际执行的代码/查询。