Hibernate中的弱实体映射

时间:2012-11-28 15:01:34

标签: java hibernate mapping

我有2个班级:

@Entity
class A{
    @Id
    long id
    @???
    List<B> bs;
}

@????
class B{
    @ManyToOne
    A a;
    @OneToOne
    C c;
    Integer a,b,c,d,e;
}

我如何让hibernate来处理它? 我不想把ID放在B级,因为它是一个弱实体?

1 个答案:

答案 0 :(得分:2)

“弱”实体是什么意思?它只是没有ID?使用

@ElementCollection
List<B> bs;

一起
@Embeddable
class B {}

查找实例here

的示例