Why is Hibernate Open Session in View considered a bad practice?

后端 未结 9 2179
轮回少年
轮回少年 2020-11-22 17:08

And what kind of alternative strategies do you use for avoiding LazyLoadExceptions?

I do understand that open session in view has issues with:

  • Layered
9条回答
  •  日久生厌
    2020-11-22 17:45

    In my own experience, OSIV is not so bad. The only arrangement I made is using two different transactions: - the first, opened in "service layer", where I have the "business logic" - the second opened just before the view rendering

提交回复
热议问题