如果控制台出现the application must supply JDBC connection错误,说明hibernate.cfg.xml中数据库配置的地方写错了,要严格检查。
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql:///t_user</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">123456</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
<mapping resource="com/entity/User.hbm.xml"/>
<mapping resource="com/entity/Customer.hbm.xml"/>