Java Frameworks War: Spring and Hibernate

后端 未结 18 2053
北海茫月
北海茫月 2020-12-23 12:08

My developers are waging a civil war. In one camp, they\'ve embraced Hibernate and Spring. In the other camp, they\'ve denounced frameworks - they\'re considering Hibernate

18条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 12:40

    Hibernate has quirks to be sure but that is because the problem it is trying to solve is complex. Every time someone complains about Hibernate I remind them of all of the boring DAO code that they would have to maintain if they weren't using it.

    A few tips:

    • Hibernate is no substitute for a good database design. Hibernate schemas are OK but you will have to tweak them occasionally
    • Eventually you are going to have to understand how Hibernate lazy loads classes and how that affects things. Hibernate modifies the Java bytecode and you will need to delve into the depths sooner or later if only to explain why object links are null.
    • Use annotations if you can.
    • Take the time to learn the Hibernate performance tuning techniques, it will save you in the long run.

提交回复
热议问题