Hibernate: More than one row with the given identifier was found error

前端 未结 10 903
有刺的猬
有刺的猬 2020-12-01 01:20

I\'m using spring 4.0.5 and hibernate 4.3.5; I\'m facing an error with hibernate and I can\'t figure where I\'m wrong (because I\'m sure I\'m wrong). I have a table related

10条回答
  •  独厮守ぢ
    2020-12-01 02:03

    If you have @OneToOne mapping in your class then update the fetch type to LAZY. Because by default fetch type for OneToOne is EAGER so when we fetch object of main class (WebTree) class, it will fetch the object for OneToOne mapped class so when hibernate map the object it will throw the exception. In Short if you have OneToOne Mapping then replace it with @OneToOne(fetch = FetchType.LAZY).

提交回复
热议问题