W3C courses
1, hibernate5 reports an error org.hibernate.boot.MappingNotFoundException: Mapping (RESOURCE) not found
hibernate.cfg.xml should be placed with the entity class
. The mapping in hibernate.cfg.xml should specify the folder
<mapping resource=" com/liu/ test /Employee.hbm.xml"/>
2,Failed to create sessionFactory object.org.hibernate.MappingException: entity class not found: Employee
class name of hibernate.hbm.xml:
<class name=" com.liu.test . Employee" table="EMPLOYEE">
3,jdbc4.MySQLSyntaxErrorException: Unknown column 'first_name' in 'field list'
hibernate.hbm.xml column is 'first_name'
when creating the table, it is 'fist_name'; the difference of one letter
5. Use annotations:
org.hibernate.MappingException: Unknown entity: com.liu.orm.Employee
The configuration file has this sentence:
<mapping class="com.liu.orm.Employee"/>
6.
@GeneratedValue换成@GeneratedValue(strategy = GenerationType.IDENTITY)
https://www.w3cschool.cn/hibernate/npyd1iek.html