An association from the table User refers to an unmapped class
2014-01-22 17:40
519 查看
运行后抛出异常
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.usertest.dao.impl.CompanyDaoImpl.save(CompanyDaoImpl.java:13)
at test.Many2OneTest.main(Many2OneTest.java:24)
Caused by: org.hibernate.MappingException: An association from the table user refers to an unmapped class: com.usertest.entity.api.ICompany
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1746)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1680)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1390)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1781)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1865)
at com.usertest.util.Toolkits.<clinit>(Toolkits.java:19)
... 2 more
经查验,需要在UserImpl.hbm.xml中修改配置
<many-to-one name="company" column="company_id" class="com.usertest.entity.impl.CompanyImpl">
其中class写绝对路径最保险
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.usertest.dao.impl.CompanyDaoImpl.save(CompanyDaoImpl.java:13)
at test.Many2OneTest.main(Many2OneTest.java:24)
Caused by: org.hibernate.MappingException: An association from the table user refers to an unmapped class: com.usertest.entity.api.ICompany
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1746)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1680)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1390)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1781)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1865)
at com.usertest.util.Toolkits.<clinit>(Toolkits.java:19)
... 2 more
经查验,需要在UserImpl.hbm.xml中修改配置
<many-to-one name="company" column="company_id" class="com.usertest.entity.impl.CompanyImpl">
其中class写绝对路径最保险
相关文章推荐
- org.hibernate.MappingException: An association from the table tuser refers to an unmapped class: Role
- An association from the table suppliersuserinfo refers to an unmapped class
- An association from the table B_USER refers to an unmapped class: com.shxt.framework.book.bo.Dict
- An association from the table refers to an unmapped class
- org.hibernate.MappingException: An association from the table tuser refers to an unmapped c
- 2.An association from the table refers to an unmapped class:错误
- An association from the table yi_community refers to an unmapped class: com。yiyi.domain.YiGroup
- hibernate错误:An association from the table ....... refers to an unmapped class
- 出现此错误An association from the table refers to an unmapped class
- 关于An association from the table refers to an unmapped class
- An association from the table work_output refers to an unmapped class: org.ejs.sys.model.Part
- An association from the table message refers to an unmapped class: pojo类名
- 关于An association from the table refers to an unmapped class
- An association from the table PersonAddress refers to an unmapped class
- An association from the table * refers to an unmapped class: *
- An association from the table student refers to an unmapped class: com.test.model.Team
- An association from the table refers to an unmapped class
- org.hibernate.MappingException: An association from the table STREET refers to an unmapped class: e
- An association from the table emps refers to an unmapped class: Dept 错误解析
- An association from the table PersonAddress refers to an unmapped class