Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Disadvantages of using Hibernate ORM

  • 06-09-2016 10: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, Registered Users 2 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