• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CRUD statements at startup time

 
Pradeep Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Hibernate. As per my understanding Hibernate generates the basic CRUD statements like SELECT, DELETE, INSERT and UPDATE at start up time for each class defined in the configuration file. If this is the case why is that not logged into the log file. If this is not the case that the CRUD statements are generated at start up time when are the statements generated.

Thanks and Regards,
Pradeep
 
rani vini
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to keep this "<property name="hibernate.show_sql" value="true"></property>" in persistence.xml.
Then it'll show all the statements in the commandline if you are running java class from commandline
 
Lalit Bhatt
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CRUD are generated in the beginning by default. You can change the behaviour also so that the statements are generated at runtime. See Hibernate Mapping class section here

Also show sql will show the statements that are issued to database and will not show the generated CRUD sql. When you actually do a CRUD operation, the sql will show up.
 
Pradeep Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the answer and the link.. All my clarifications got clarified with respect to dynamic insert as well as CRUD statements generation. Also the point is valid stating that the CRUD statements generated at start up time is used internally and will not be logged until the statement is passed to the DB when the statement is logged.

Thanks and Regards,
Pradeep
 
Lalit Bhatt
Ranch Hand
Posts: 69
Java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic