如果運行時報這個錯誤:hibernate.properties not found。 可以是因為"Students.hbm.xml"這個文件沒有生成到src目錄下,而是生成到了mysql-jdbc目錄下。只需將"Students.hbm.xml"拖放到src目錄下就好了。
2017-06-18
親測hibernate5.2.10使用自動提交,Junit測試會報錯javax.persistence.TransactionRequiredException: no transaction is in progress,使用transaction應該更方便
2017-06-18
hibernate.cfg.xml文件中的url元素要改為實際的:(不然無法正常寫入)
<property name="connection.url">jdbc:mysql://127.0.0.1:3306/hibernate?useUnicode=true&amp;characterEncoding=UTF-8</property>
<property name="connection.url">jdbc:mysql://127.0.0.1:3306/hibernate?useUnicode=true&amp;characterEncoding=UTF-8</property>
2017-06-17