欢迎投稿

今日深度:

以Java属性文件的格式创建Hibernate的配置文件和

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



示例代码

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特殊符号作用

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

+           该子元素在父元素内必须存在,可以存在一次或者多次

*            该子元素在父元素内可以不存在,或者存在一次或者多次,它是比较常用的符号

?          该子元素在父元素内可以不存在,或者只存在一次,它是比较常用的符号



www.htsjk.Com true http://www.htsjk.com/shujukunews/9438.html NewsArticle 以Java属性文件的格式创建Hibernate的配置文件和DTD特殊符号作用,hibernatedtd 示例代码 hibernate.dialect=org.hibernate.dialect.MySQLDialecthibernate.connection.driver_class=com.mysql.jdbc.Driverhibernate.connection.u...
评论暂时关闭