Hi Kaushik, your teaching skills are exceptional!!! I am happy that teachers like you still exist in this world ! I am so fortunate to get to learn from you online !
@smrtfasizmu61612 жыл бұрын
I got that exception near the end. I didn't understand what's going on. So, I just went browsing about lazy loading to see what's going on. I expected to learn more about lazy loading in this video, I didn't expect to see the solution and an explanation to my problem immediately. Thank you!
@deepakjava35064 жыл бұрын
I made my career in IT because of you.
@frankmyatthu240611 жыл бұрын
Excellence explanation about Lazy Loading vs Eager Loading , Thank you sir
@Java.Brains12 жыл бұрын
Yes. Any object that Hibernate returns could be a proxy. However, in this case, it's the User that needs to be proxied to support lazy fetch. It's a call to a UserDetail class getter that needs to fetch data on access.
@TheDanielBarcellos10 жыл бұрын
one of the best tutorial i've ever seen! congratulations
@abhishekkumargupta99803 жыл бұрын
These are very high class videos. Thank you Koushik. You have helped me learn many things.
@amsfuy11 жыл бұрын
It's really not exaggerated when I say that I love all your videos!
@brijeshwani1016 жыл бұрын
These are really awesome tutorials. Very easy to understand. Keep it up....
@niraj11198112 жыл бұрын
Very good explanation about Lazy nd Eager fetch..... Thanks..
@SumitKumarSahu7912 жыл бұрын
Excellent video. It makes the JPA easy for me.
@reloaderify5 жыл бұрын
You are creating a world of well-informed developers. Nice work!
@MrDishajain4 жыл бұрын
Very informative and detailed video.
@ashwinjayaram69548 жыл бұрын
very good tutorials Koushik. Thank you and pls keep up the good work.
@TheCreativityAddict11 жыл бұрын
happy teachers day Koushik!! Nice tutorials, really helpful
@Lallushe4 жыл бұрын
Very well explained. Thank you!
@munishtyro10 жыл бұрын
Your efforts are adorable !! thanx man
@vikasm808 жыл бұрын
Very well explained the concept :)
@12345ms13 жыл бұрын
These videos are invaluable, U're awesome thanks! mate
@rash80511510 жыл бұрын
you are awesome...the tutorial is awesome...the world is awesome. Thanks. :)
@programacion36947 ай бұрын
buen video, muy explicativo :)
@rohitjbhagwat8 жыл бұрын
Hibernate doesnt fire the select query if you just call user.getListOfAddresses(). it calls only when you are trying to get information of data inside collection like user.getListOfAddresses().size(). By writing user.getListOfAddresses() will print only the proxy object without the select being fired. Also there is no proxy of User class, instead the proxy object of collection is created.
@walecharohit7 жыл бұрын
Thanks man..I dint lykd his explanation about proxies
@adityasrivastava40485 жыл бұрын
@@walecharohit i agree ,thanks Rohit Bhagwat
@adityasrivastava40485 жыл бұрын
As per Koushik UserDetails proxy object is created, if it is a proxy object then why select query is being fired?, only proxy object of collection is created. whereas if we use load() method then it is not firing a query i think in that case proxy of UserDetails is created @JavaBrains could you please let us know?
@SurajBajaj11 жыл бұрын
KZbin has lot of entertaining videos. Please do watch them. This was meant for teaching Hibernate, which it does.
@walecharohit7 жыл бұрын
I am not getting any LazyInitializationException even on specifying the FetchType as Lazy :/
@crist2000a7 жыл бұрын
good tutorial indeed. However still did not get why Colletion Interface is used instead of collection implementation. In previous session it was said that it will be explained here.
@atamishali7 жыл бұрын
Collection interface is used because if at any point in future we require to change the implementation (say we decide to use LinkedList instead of ArrayList) we can do this directly without making enough changes in code. This is called programming by interface rather than implementation.
@3SurajPatil6 жыл бұрын
Ali is right , what if I need Set implementation instead of List implementation. we can change directly the implementation class. or we can pass as a bean from spring.
@shanedetsch7 ай бұрын
What eclipse hibernate plugin do you recommend using?
@Mladenac12 жыл бұрын
Defaults for Hibernate is always lazy fetching, but for JPA 2.0 (EclipseLink) is eager for some kind of associations.
@Exceptionhandler20211 жыл бұрын
you might already know that stuff but a totally new guy needs a little more details thats why i guess he explains it in so detail
@venkatanagasai73544 жыл бұрын
Hi Sir, your tutorials are really good and explanation is very clear. I have a doubt running in my mind that i read several blogs about session.get() returns fully qualified object whereas session.load() returns proxy object. but, In the tutorial u have mentioned that the session.get() returns the proxy object and calls the base class methods. which one is true?
@swatimantri24417 жыл бұрын
While debugging as explained in the tutorial I am getting address object as well. I don't understand then how this corresponds to lazy initialisation? If you could explain
@siddhaarth88435 жыл бұрын
Hi Koushik, excellent tutorials as usual, but I have a doubt : when I print the class of the retreived object using session.get(), it still shows the original class, and not some proxy class, why is this ?
@virupakshasg12 жыл бұрын
Thanks for such great videos. Are you sure Hibernate creates proxy for User and not for Address? Address is what needs to be stubbed. I placed a breakpoint at session.get() and see that object returned is of type UserDetails (before cast as well). Address is of type PersistentIdentifierBag which seems to be a wrapper (proxy).
@mayurd238 жыл бұрын
Does it mean every time we run 'select' operation, hibernate creates a proxy object and we call methods of that proxy objects only ?
@JamesJ30t9 жыл бұрын
@Java Brains One thing that puzzles if this Proxy class extends a base class. You cast using a base class cast would you not be calling functions from the base class?
@Java.Brains9 жыл бұрын
JamesJ30t Nope. It depends on the instance you have. Think of it as a wolf in sheep's clothing. It's still a wolf underneath! Look up how polymorphism works.
@JamesJ30t9 жыл бұрын
Java Brains The confusion comes from working with c++. Upcasting (casting derived class to base class) in c++ access base functions and classes only. C++ and java differ on this. www.tutorialcup.com/cplusplus/upcasting-downcasting.htm
@JamesJ30t9 жыл бұрын
+Java Brains Did some testing one thing with Java is that when you upcast you can only access the procedures that have been overridden. That must be due to polymorphism. Also you only have access to the properties in the base class the subclass properties are hidden.
@asbalakrishna10 жыл бұрын
Superb Sir..........
@rogeroliveira49737 жыл бұрын
Amigo, estou recebendo o seguinte erro quando tento fazer um GET em tabelas que possuem relacionamento: "java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter?" A meu ver a biblioteca Gson está tendo problemas ao receber a lista de objetos e converter para JSON. Sabe como resolver isso? Obrigado.
@raghebadel568912 жыл бұрын
Thank you, it's great tutorial, i have a question, what does session exactly means ??? how can i manage sessions through my application
@aoozzooa479411 жыл бұрын
Hi Koushik! Thank u for such great tutorials. I have a question, kindly clarify. 1) Instead of session.get, if we use session.load, unless we access the non-primary entities of a model/POJO class, no fetching is done from the db. Can this also be called a lazy fetching? 2) With sesion.load, even if Fetchtype=Eager, trying to fetch a collection after closing the session, it still throws an error LazyInitializationException. Either case, using session.load is always a LazyFetching. Is that rt?
@SuperNunien8 жыл бұрын
You say the list is fetched when the getter is called, but I believe it is when the list is actually used : user.getListOfAdresses(); // nothing is fetched user.getListOfAdresses().size(); // list is fetched
@curious_sapien6 жыл бұрын
You're right
@AkashKeserwani7 жыл бұрын
With new versions of Hibernate, I don't think this concept still holds. I am not able to make any lazy fetch scenario even after specifying the FetchType as Lazy.
@jonassx1006 жыл бұрын
same
@theworldminusraphtheninjat43784 жыл бұрын
mr i ahve a problem with lazy initialize i want to parse to JSON object i cant cuz of lazy initialize i have been stuck in this problem for a bout 4 month now and i still cant solve it the only way i found is to open multiple sessions to get one object like if i have multy level object like user inside it an obj of employee inside it an object of department it make my life hell pls if u know how to solve it in a better way help me some times the information is crucial and must be fetched one time but hibernate wont make me get but one eager fetch
@goodlifenepal11 жыл бұрын
Really useful thank you .!!
@surajankita15 жыл бұрын
After session.close() if you r trying to fetch user.getName() it is showing the name?.How is it possible? because after session close all objects will be clear from cache
@programacion36947 ай бұрын
the name was already loaded before sesion.close() so it dosent matter if you close or not, the member name is loaded when the session.get() retrieves from the db.
@qwerteeeeeee12311 жыл бұрын
Hi As we will reach to user.getAddress, will load 100 of addresses but is there any way where I can specify to load the addresses who lives in bombay. in this I can only think of writig a query which get the data of bombay location, is there any other way in hibernate itself
@beyondthehorizon947 жыл бұрын
Thank you so much, i love you
@daniellimbu978110 жыл бұрын
Hi koushik first of all, thank you very much for providing such a great tutorials. You are awesome.!! I am confused that I learned session.load() will only return a proxy object while session.get() will return real object that is instance of user class . But as you said in the video proxy object of user class is returned by session.get(). I am having confusion over here. Thanks
@anshuldogra76077 жыл бұрын
A late reply but what I understand is that session.get() returns us the original object via proxy object. But session.load() directly returns the proxy object without the original object coming into the picture.
@DeepakPandey-ij3bz8 жыл бұрын
I think session.get do not create proxy. Reasons are : 1.If constructor of userDetails entity is private then it will generate exception when we use session.load same scenario with session.get not throw exception. 2. For session.load JavassistProxyFactory creates proxy but in case of session.get there is a condition in Entity.class of hibernate. Below condition is false. if ( proxyOrEntity instanceof HibernateProxy ) { ( (HibernateProxy) proxyOrEntity ).getHibernateLazyInitializer() .setUnwrap( isProxyUnwrapEnabled ); } Also the fetchType is related to Collection as shown in @OneToMany (By default Lazy for @OneToMany and @ManyToMany) due to which lazy initilization exception was thrown. hese 2 things are different as per my understanding.
@IntergalaticSabotage13 жыл бұрын
Great stuff!
@__vv__13 жыл бұрын
This is awesosme .
@remusik0412 жыл бұрын
i agree. Thank you koushks
@quinnd69 жыл бұрын
Yep as I said before the program has a problem for me. If I run it twice the second time I run it hangs on Hibernate: alter table USER_ADDRESS drop constraint FK_rr7b0tc5khp6fevg5vf9ctn5
@gillianbc9 жыл бұрын
+quinn d6 Try dropping the tables manually. Might be caused by renaming the table during our exercises and some references have been left behind.
@ialpha64316 жыл бұрын
Amazing if you were using Django querysets , they are almost the same.
@sanjay0056 жыл бұрын
I still didn't get why hibernate is creating a Proxy instead of providing user class directly.
@francesconuma12 жыл бұрын
I read an interesting question on stackoverflow. com/questions/5027013/hibernate-lazy-load-application-design about lazy loading entities in DAO layer. What do you think about? Regards. Thanks for your videos.
@farrukhahmedsid6 жыл бұрын
8:12 proxy diagram
@omidmohebbi7426 жыл бұрын
Thank you a lot.
@gigel00811 жыл бұрын
Wow... this was revelatory.
@rak2k13 жыл бұрын
thanks you bro
@quinnd610 жыл бұрын
Ah crap I'm getting this in eclipse. Hibernate: alter table USER_ADDRESS drop constraint FK_rr7b0tc5khp6fevg5vf9ctn5
@Adapt-wj5gi7 жыл бұрын
You have good tutorials , but you have to explain this topic more deeply and give some others examples and problems with that fetching types!
@francesconuma12 жыл бұрын
thanks
@paranoid079211 жыл бұрын
why do you say so?
@walecharohit7 жыл бұрын
Not good explanation about proxy class.. :/
@puneethshivalingaiah9 жыл бұрын
:) :) :)
@sunnydube12 жыл бұрын
Videos are good but when you explain the concepts IT IS THE WORST EXPLAINATION YOU WILL GET ON THE EARTH..... SERIUOSLY VERY POOR EXPLANATION OF CONCEPTS ...
@amogh1211 жыл бұрын
i dinn ask you sob
@amogh1211 жыл бұрын
your lectures are good ... I feel you waste lot of time talking ... its total unnecessary to go in that detail ... this really bored me and made me close video