Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Disadvantages of using Hibernate ORM

Options
  • 06-09-2016 11:11am
    #1
    Closed Accounts Posts: 6,075 ✭✭✭


    Can anyone tell me why one would not use Hibernate ORM?

    My take:
    • Slower - if I just want the age column from the Person table, I must retrieve the entire Person object (same with persisting)
    • Slower than JDBC


Comments

  • Closed Accounts Posts: 2,267 ✭✭✭h57xiucj2z946q


    Can anyone tell me why one would not use Hibernate ORM?

    My take:
    • Slower - if I just want the age column from the Person table, I must retrieve the entire Person object (same with persisting)
    • Slower than JDBC

    For small use-cases (simple selects only, no updates, inserts, deletes), using an ORM solution might be considered over engineering.


  • Closed Accounts Posts: 6,075 ✭✭✭IamtheWalrus


    For small use-cases (simple selects only, no updates, inserts, deletes), using an ORM solution might be considered over engineering.

    In Hibernate, does HQL solve the problem in my first point above?


  • Registered Users Posts: 159 ✭✭magooly


    If you choose to use an ORM you should to stick with JPA as its a standard with hibernate as the implementation. (TiP: JPA + Hibernate with Spring Data)

    Negatives for an ORM:

    The DB is abstracted away from the developer so in many cases you will not be sure (and surprised!) what querys are executing and more worrying how many (n+1 problem). TRACE query logging is a valuable here.

    The devs become lazy and any SQL skills quickly wane when not in use

    When a performance issue comes up its more than likely solveable with a custom JPQL.

    A certain level lf expertise will be needed once you start mapping complex relationships.

    For simple web based apples and oranges an ORM is not a bad idea and its a good skill to have in the industry.

    As a counter - without an ORM any refactoring of tables and columns will most likely break multiple queries. Spring data and JPA will give some protection against this.


Advertisement