细节决定成败--hibernate的cfg文件
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration 3.0.dtd"> <hibernate-configuration><!-- <session-factory> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jbdc:mysql://localhost:3306/helloworld</property>//错误点在这里“jdbc” <property name="connection.username">root</property> <property name="connection.password">root</property> <property name="show_sql">true</property> <property name="format_sql">true</property> <mapping resource="com/hibernate/bean/Student.hbm.xml"/> </session-factory> --> <session-factory> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.username">root</property> <property name="connection.password">root</property> <property name="connection.url">jdbc:mysql://localhost:3306/helloworld</property> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="show_sql">true</property> <property name="hibernate.format_sql">true</property> <mapping resource="com/hibernate/bean/Student.hbm.xml"></mapping> </session-factory> </hibernate-configuration>
注意一些细节问题,坑了我好久这个问题。