把log4j.xml文件放入项目src目录下,打开
删除File与RollingFile标签包含的内容(它们会自动生成两个文件夹,存文件的)
这样做的作用:
当我们在运行操作数据库的方法时,自动加载hibernate.propertites文件,但找不到,需要我们给它配置;
src下新建一个文件file叫hibernate.propertites
打开编辑:
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://192.168.40.115/test
hibernate.connection.username=Leizedeng
hibernate.connection.password=123456
在把hibernate.cfg.xml文件中的DB连接四要素(在另一篇博文中--》hibernate的主配置文件)注释掉
保存运行
这样就可以找到hibernate.propertites了
hibernate.propertites该文件一般不用它
加入hibernate.cfg.xml有DB连接四要素没注释
hibernate.propertites中也有DB连接四要素
但两个连接的数据库不同
会先加载谁呢?
xml文件的优先级更高
会运行hibernate.cfg.xml配置文件
删除File与RollingFile标签包含的内容(它们会自动生成两个文件夹,存文件的)
这样做的作用:
当我们在运行操作数据库的方法时,自动加载hibernate.propertites文件,但找不到,需要我们给它配置;
src下新建一个文件file叫hibernate.propertites
打开编辑:
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://192.168.40.115/test
hibernate.connection.username=Leizedeng
hibernate.connection.password=123456
在把hibernate.cfg.xml文件中的DB连接四要素(在另一篇博文中--》hibernate的主配置文件)注释掉
保存运行
这样就可以找到hibernate.propertites了
hibernate.propertites该文件一般不用它
加入hibernate.cfg.xml有DB连接四要素没注释
hibernate.propertites中也有DB连接四要素
但两个连接的数据库不同
会先加载谁呢?
xml文件的优先级更高
会运行hibernate.cfg.xml配置文件