org.hibernate.InvalidMappingException:Could not parse mapping document from resource com/lara/Person.hbm.xml

前端 未结 4 757
时光取名叫无心
时光取名叫无心 2020-12-12 01:35
Exception in thread \"main\" org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/lara/Person.hbm.xml
    at org.hibernate.cfg.C         


        
4条回答
  •  时光取名叫无心
    2020-12-12 01:57

    it's simple

    1.create constructor

    public Person(){}
    

    this is main thing in hibernate. it will map the object through this constructor(using Java Reflection Concept)

    2.Understand the dtd. there are two types of dtd available mapping dtd and configuration dtd

    Mapping-dtd is

    
    
    

    configuration dtd is

    
    
    

    hibernate.cfg.xml is configuration file and Person.hbm.xml is Mapping File so change the dtd in Person.hbm.xml

    it will run.

提交回复
热议问题