Hibernate automatically builds tables by configuring <property name= "Show_sql" >true</property> and <property name= "Hbm2ddl.auto" > Create</property> can automatically build a table and display the statement that inserts the data in the console, but cannot display the build statement, This is because hibernate comes with the log Environment Slf4j-api interface Implementation JAR Package Slf4j-nop-1.5.8.jar is not perfect, SLF4J-API interface is implemented in many ways, to display the table statements need to use log4j jar package to implement SLF4J-API interface, because Log4j cannot implement the Slf4j-api interface directly also requires a translator Slf4j-log4j12-1.5.8.jar.
So you can implement the console display statement by simply doing the following:
1. Remove the original Slf4j-nop-1.5.8.jar join Log4j-1.2.15.jar
2. and add the converter Slf4j-log4j12-1.5.8.jar
3. Of course, you must also put the interface: Slf4j-api-1.5.8.jar
4. In the catalogue hibernate-distribution-3.6.0.final-dist\hibernate-distribution-3.6.0.final\project\ etc, locate the file log4j.properties, copy it to the project SRC directory and open it,
You can find the statement: Log4j.logger.org.hibernate.tool.hbm2ddl=debug, which is the configuration used to display the DDL statements, and other configurations to display other information, not to comment out
5. Run the program to view the table statement printed by the console.
Note: Slf4j-log4j12-1.5.8.jar and Slf4j-api-1.5.8.jar are in the same SLF4J official Download version folder
Download website:
http://www.slf4j.org/dist/
Http://logging.apache.org/log4j/1.2/download.html