org.hibernate.MappingException: Unknown entity: annotations.Users

前端 未结 19 1631
情歌与酒
情歌与酒 2020-12-01 07:11

Consider the hierarchy :

\"enter

And the following classes and xml :

19条回答
  •  我在风中等你
    2020-12-01 07:56

    The Hibernate configuration file must define the entity classes:

    
    

    Or you must explicitly add the class to the configuration using

    configuration.addClass(annotations.Users.class)
    // Read mappings as a application resourceName
     // addResource is for add hbml.xml files in case of declarative approach
    configuration.addResource("myFile.hbm.xml");  // not hibernateAnnotations.cfg.xml
    

提交回复
热议问题