Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please explain me the hibernate generated sql queries in console

 
Harishwar Madhya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate is open source. If you want to know why it does what it does you can look at the source.
 
Harishwar Madhya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best detail you'll get is in the source. Not sure I can explain otherwise.
 
Christian Dillinger
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic