Skip Navigation Links



Difference between get and load in Hibernate

Author : Javin Paul      Blog :TIBCO RV FIX PROTOCOL JAVA TUTORIAL      Date: 7/21/2012 12:35:00 PM


get vs load in Hibernate
Difference between get and load method in Hibernate is a one of the most popular question asked in Hibernate and spring interviews. Hibernate Session  class provides two method to access object e.g. session.get() and session.load() both looked quite similar to each other but there are subtle difference between load and get method which can affect performance of application. Main difference between get() vs load method is that get() involves database hit if object doesn't exists in Session Cache and returns a fully initialized object which may involve several database call while load method can return proxy in place and only initialize the object or hit the database if any method other than getId() is called on persistent or entity object. This lazy initialization can save couple of database round-trip which result in better performance. By the way there are many articles on interview questions in Java, you can use search button on top left to find them. Some of them like 20 design pattern interview questions and 10 Singleton pattern questions are my favorites, you may also like. Coming back to article, you can find more difference between load and get in rest of this article in point format but this is the one which really makes difference while comparing both of them. If you look at how get and load gets called its pretty identical.
Read more »

Bloggers

active bloggers in the last 24 hrs. Number shown in the bracket represents number of posts published in past 24 hrs,


other authors(64)

AMJAD KHAN(7)

Firoze Shakir Photographerno1(6)

sumana Mukhopadhyay(4)

RWABhagidari.blogspot.com(3)

sankarshan(3)

Ambica Srimal(2)

BUTTERFLIES OF TIME(2)

Nish(2)

Sameena Prathap(2)

SEO(2)

Srinivasan Sampathkumar(2)

Vikram Karve(2)

Abrachan Pudussery(1)

Adriana(1)

Aliena Varghese(1)

Amarendra(1)

Anisha Aditya(1)

anisnest(1)

anouradha bakshi(1)

Anu Lal(1)

Anukampa(1)

Aruna Manikandan(1)

Ashwini Kumar(1)

Beyond(1)

Bharathi(1)

Bombay Chowparty(1)

churumuri(1)

churumuri(1)

Cynical(1)

Cynthia Z(1)

Daksha(1)

Deeps(1)

Devi(1)

Dew(1)

Disha(1)

DivSu(1)

Eon Heath(1)

Geek Girl(1)

Hari Chandana P(1)

Himangshu(1)

Indrani(1)

Indrani(1)

Itchingtowrite(1)

jaideep khanduja(1)

Kalyani(1)

Kumar Harsheet Raj(1)

Love Baronia(1)

Madhaw Tiwari(1)

-Manoj(1)

Meena(1)

Megha(1)

mervin anto(1)

Miss Frangipani(1)

MISTAKE(1)

Mohammad Khalid Siddiqui(1)

monikamanchanda(1)

Neha(1)

nik hill(1)

nikschumi(1)

Nisa Homey(1)

Nithya(1)

Nivedita Thadani(1)

P.(1)

palsworld(1)

pixie(1)

Piyush Kaushal(1)

Pooja(1)

Pooja Sharma Rao(1)

Prasanta Bora(1)

Praveen Battula(1)

Preety(1)

Priya Srinivasan(1)

Raafay Awan(1)

rads(1)

Ragesh Chakkadath(1)

Ram Bansal(1)

Ram Bansal(1)

Ramanujam Sridhar(1)

Rams(1)

Richa Singh(1)

RNA Corp(1)

Robinsh Kumar(1)

Rohit Rajpal(1)

Sachita(1)

saffronstreaks(1)

Sameena Prathap(1)

sangeeta(1)

Sangeetha M(1)

Sangitha(1)

Sankara Subramanian(1)

sareez(1)

Sharjeel(1)

Shobha(1)

Shweta Ganesh Kumar(1)

Simran(1)

Slogan Murugan(1)

Sneo(1)

Sophie(1)

Sree(1)

Srikanth(1)

Suchismita(1)

Surya.(1)

tikulicious(1)

Vashi Chandiramani(1)

Vasudha Rao(1)

Vishesh Shrivastava(1)

vskesavarao(1)

wildflower(1)

Zardy(1)

ജിവിന്‍ ജോണ്‍(1)


garland of Languages of India
an amalgamation of the diversified traditions
gracefully presented with novelty
http://www.haaram.com