ids for this class must be manually assigned before calling save()

后端 未结 3 702
情书的邮戳
情书的邮戳 2021-01-02 17:38

I\'ve got some problem with hibernate @OneToMany mapping. It goes like here

@Entity
@Table(name = \"albums\")
@SequenceGenerator(name = \"ALBUMS         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 18:31

    First - it can't generate them because you didn't tell it how to do it. Use @GeneratedValue and choose the strategy you want.

    Then - you can't have two @Id fields. If you want a composite id use @EmbeddedId or @IdClass

提交回复
热议问题