[Hibernate系列—] 1. 下载与试用Hibernate(MySQL与Oracle 配置)
来源:互联网 发布:爱q资源网源码 编辑:程序博客网 时间:2024/05/22 09:06
http://blog.csdn.net/oscar999/article/details/27237027
入门来说不错,如果hibernate数据写入不进数据库,问题一般出现在配置文件写的有问题。
如果这样写,就无法连接数据库
<session-factory>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.url">jdbc:mysql://localhost:3306/yangling</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="hibernate.connection.autocommit">true</property>
<property name="connection.driver_class">com.mysql.fabric.jdbc.FabricMySQLDriver</property>
<property name="myeclipse.connection.profile">com.mysql.jdbc.Driver</property>
<mapping resource="cn/nwsuaf/gov/model/Train_Teachers.hbm.xml"/>
</session-factory> -->
如果这样写,就没有问题
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/yangling</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Disable the second-level cache
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property> -->
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup-->
<property name="hbm2ddl.auto">create</property>
<!-- Names the annotated entity class -->
<mapping resource="cn/nwsuaf/gov/model/Train_Teachers.hbm.xml"/>
</session-factory>
问题出现在哪里了。
- [Hibernate系列—] 1. 下载与试用Hibernate(MySQL与Oracle 配置)
- [Hibernate系列—] 1. 下载与试用Hibernate(MySQL与Oracle 配置)
- Hibernate与Mysql,Oracle连接
- hibernate查询时间兼容mysql与Oracle
- hibernate与mysql longText
- 集成与配置Hibernate
- Hibernate的下载与安装
- hibernate学习——hibernate配置与关联总结
- 【Hibernate】Middlegen-Hibernate 配置与使用
- 【Hibernate】(2)Hibernate配置与session、transaction
- hibernate与oracle的clob
- mysql与hibernate的兼容性
- mysql与Hibernate的整合
- Hibernate与Mysql乱码问题解决
- hibernate与Mysql-Dialect问题
- Hibernate 与Mysql 关键字冲突
- Hibernate 的原理与配置
- Hibernate 的原理与配置
- bootstrap实现loading
- 周记(三)
- valgrind 与memwatch
- 蓝牙低能耗技术简介
- Android debug.keystore的密码
- [Hibernate系列—] 1. 下载与试用Hibernate(MySQL与Oracle 配置)
- java泛型编程
- 简述类目的优缺点,如果覆盖了本类或者父类的方法 ,会出现什么问题
- Apache:设置首页运行index.html index.php的顺序
- Java运算符
- VHD恢复操作系统
- linux scp远程拷贝文件及文件夹
- 《Effective C++》18: 让接口容易被正确使用,不易被误用
- python中若干高级编程技巧