File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Please explain me the hibernate generated sql queries in console Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Please explain me the hibernate generated sql queries in console" Watch "Please explain me the hibernate generated sql queries in console" New topic
Author

Please explain me the hibernate generated sql queries in console

Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
Hi All,

Just recently started learning Hibernate.. Here Im posting some sample code which I have got the output perfectly, but I havent understood exactly the generated SQL queries. Please see the whole code ...





















Here are the SQL queries generated after executing that "Main" class... Please explain me how hibernate considering what order so that it displayed those SQL queries .. I mean why it inserted first LOCATION then EVENT then SPEAKER then again LOCATION then EVENT_LOCATION ?? Im unable to understand the order of those sql queries..




waiting for replies...



Thanks,
Harishwar
Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
Please anyone reply to this..... Im very much interested to know how Hibernate thinks.... pleasse someone understand my whole code and provide me understanding...

waiting for some replies....

Harishwar
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Hibernate is open source. If you want to know why it does what it does you can look at the source.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Harishwar Madhya
Greenhorn

Joined: Sep 01, 2010
Posts: 14
My actual doubt is considering my Main.java code, how its generating SQL squeries?? Im getting those SQL generated queries considering my Main.java code or any thing other reason?? I would like to know why it inserted Location, then Event, then Speaker, then again Speaker, then Location, then Event , then EVENT_LOCATION ( 4 times) , howz it all going?? why it generating those sql queries in that order by considering what??

please some explain me clearly regarding this..



Harishwar
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

The best detail you'll get is in the source. Not sure I can explain otherwise.
Christian Dillinger
Ranch Hand

Joined: Jul 20, 2009
Posts: 189
Does ordering have any relevance? No, it doesn't. But: Some statements MUST be fire earlier than others, because you need an identifier or something for some other statements. If you don't have any condition like that, you shouldn't care about.
If you are interested on it because you want to understand whats "under the hood" take a look at the sources as Paul said.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please explain me the hibernate generated sql queries in console