Create a configuration file for Hibernate and a special DTD symbol in the format of a Java property file.
Sample Code
hibernate.dialect=org.hibernate.dialect.MySQLDialecthibernate.connection.driver_class=com.mysql.jdbc.Driverhibernate.connection.url=jdbc:mysql://localhost:3306/SAMPLEDBhibernate.connection.username=roothibernate.connection.password=1234hibernate.connection.show_sql=true
Attribute
Hibernate. dialect specifies the SQL dialect used by the database
Hibernate. connection. driver_class specifies the driver of the database.
Hibernate. connection. url specifies the URL of the connection data
Hibernate. connection. username specifies the username used to connect to the database.
Hibernate. connection. password specifies the password to connect to the database
If hibernate. connection. show_ SQL is set to true, the SQL statement is output on the console when the program is running. This is helpful for tracking the running status of Hibernate. The default value is false. In the application development and testing phase, you can set this attribute to true to track and debug the application. In the application release phase, set this attribute to false, reduces application output information and improves running performance.
Special DTD symbols
The sub-element must exist only once in the parent element.
+ The child element must exist in the parent element. It can exist once or multiple times.
* This child element may not exist in the parent element, or may exist once or multiple times. It is a commonly used symbol.
? The child element does not exist in the parent element, or only exists once. It is a common symbol.