以Java属性文件的格式创建Hibernate的配置文件和DTD特殊符号作用

演示样例代码

hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost:3306/SAMPLEDB
hibernate.connection.username=root
hibernate.connection.password=1234
hibernate.connection.show_sql=true

属性

hibernate.dialect  指定数据库使用的sql方言   

hibernate.connection.driver_class指定数据库的驱动程序

hibernate.connection.url指定连接数据的URL

hibernate.connection.username指定连接数据库的用户名

hibernate.connection.password  指定连接数据库的口令

hibernate.connection.show_sql  假设为true。表示程序执行时,会在控制台输出sql语句,这有利于跟踪Hibernate的运  行状态,默觉得false。在应用开发測试阶段,能够把这个属性设为true,以便跟踪和调试应用程序,在应用公布阶段。应该把这个属性设为false,一边降低应用的输出信息。提高执行性能


DTD特殊符号作用

无符号  该子元素在父元素内必须存在且仅仅能存在一次

+           该子元素在父元素内必须存在。能够存在一次或者多次

*            该子元素在父元素内能够不存在。或者存在一次或者多次。它是比較经常使用的符号

?          该子元素在父元素内能够不存在,或者仅仅存在一次,它是比較经常使用的符号



原文地址:https://www.cnblogs.com/brucemengbm/p/6824631.html