Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:51:02+00:00 2026-05-16T05:51:02+00:00

I am using hibernate for the first time for one of my projects. One

  • 0

I am using hibernate for the first time for one of my projects. One of the entity is Education(StudentObject, CollegeObject, MajorObject, degreeString). To insert Education object into database, i’ve to load student, college and major object from database and then instantiate it and persist. How is this better than just plain sql(insert into..) query? Wouldn’t sql queries be faster, as there is no overhead of loading 3 diff objects from database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:51:03+00:00Added an answer on May 16, 2026 at 5:51 am

    Wouldn’t sql queries be faster, as there is no overhead of loading 3 different objects from database?

    Correct me if I’m wrong but from where do the IDs of the StudentObject, CollegeObject and MajorObject come if not from the database? And if they’re some kind of reference data, they’re perfect candidates for second level caching (and this would mean no database hit at all).

    Regardless of your answer, here is my opinion on using an ORM such as Hibernate for a typical CRUD application:

    • It reduces development time by removing all the annoying code required for manual CRUD.
    • It provides nice features such as lazy loading, second level caching, query caching
    • To my experience, it generated better SQL than the average developer
    • For 80% of the use cases, it will just works fine
    • And even after spending time to tune the other 20%, you’ll still be done faster than without ORM.

    To sum up, the whole point is to improve the productivity of developments and my experience is positive from this point of view. In general, it performs really well, actually even better than custom code (thanks to lazy loading and 2nd level cache).
    For some use cases, the performances won’t be “as good” as with custom SQL though. But tuning is possible.

    Back to your question, I think the benefits are worth a possible overhead on some use cases (although I’m still not convinced your example is a good one). But do you actually have a performance problem?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using NHibernate for the first time and struggling. On web page one, I
It's my first time I'm using ComboPooledDataSource in hibernate, but there's something wrong with
It's my first time using nHibernate (also never used hibernate), and i'm trying to
We're developing a new eCommerce website and are using NHibernate for the first time.
I'm trying to use Hibernate for the first time, and early on in the
I am using ASP.NET-MVC and nHibernate for the first time. Great tools, but big
I am using NHibernate (version 1.2.1) for the first time so I wrote a
I'm have a lot of time using hibernate (JPA) in java, but i recently
I've been using NHibernate (with Fluent-NHibernate mappings) in a project for the first time
I am new to using Fluent NHibernate and NHibernate for the first time. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.