You also need to configure the object class to hibernate. cfg. xml, so that Hibernate can initialize the ing between the object class and the database table. If only the ing is configured, but not to hibernate. cfg. in xml, Hibernate still does not know which classes are Entity classes, because Hibernate cannot traverse all classes to determine which classes are Entity classes. A. if the object class is configured with @ annotation, you must use <mapping class = ""/> to configure the object class. In this way, their corresponding relationships have already been annotated with the object class, for example: @ Entity @ Table (name = "product_attribute") public class ProductAttribute {@ Id @ GeneratedValue (strategy = GenerationType. AUTO) private Integer id; @ ManyToOne (cascade = CascadeType. MERGE) @ JoinColumn (name = "productId") private ProductInfoEntity productInfo; @ ManyToOne (cascade = CascadeType. MERGE) @ JoinColumn (name = "pro_attr_m EtaId ") private ProductAttributeMetaEntity productAttributeMeta; @ Column (name =" value ") private String value; B. if the XML file is used for configuration, you must use <mapping resource = ""/> to configure the XML configuration file. For example, each object model (entity) should have its own configuration file named "entity name. hbm. xml, and finally the object name. hbm. xml is introduced to hibernate. cfg. c. code hibernate. cfg. xml # declare the object class configured with @ annotation in Hibernate <mapping class = "com. helloweenvsfei. hibernate. bean. department "/> <mapping class =" com. helloweenvsfei. hibernate. bean. employee "/> # declare the object class configured with XML in Hibernate <mapping resource =" com/helloweenvsfei/hibernate/bean/Event. hbm. xml "/> <mapping resource =" com/helloweenvsfei/hibernate/bean/Cat. hbm. xml "/>