Reading a Set in PostLoad on JPA/Hibernate

前端 未结 1 443
暗喜
暗喜 2021-01-06 16:10

I have a simple entity with OneToMany relation :

@Column(name = \"TITLE\")
private String _title;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EA         


        
相关标签:
1条回答
  • 2021-01-06 17:02

    Hibernate unfortunately simply doesn't allow you to do that. In an @PostLoad method, you are not allowed to touch any association in the entity. This is a long standing major bug.

    For the original bug see: https://issues.jboss.org/browse/JBAS-5474. After the bug was closed (while still unresolved), a new one was immediately re-opened here: https://hibernate.onjira.com/browse/HHH-6043

    If this bug bugs you (I guess it does), please vote for it.

    0 讨论(0)
提交回复
热议问题