为了账号安全,请及时绑定邮箱和手机立即绑定

org.hibernate.MappingException: Unknown entity: com.ss.entity.Grade?有朋友知道这是什么问题吗?

十一月 28, 2016 8:12:19 下午 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection

INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@24569dba] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.

Exception in thread "main" org.hibernate.MappingException: Unknown entity: com.ss.entity.Grade

at org.hibernate.metamodel.internal.MetamodelImpl.entityPersister(MetamodelImpl.java:620)

at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1605)

at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)

at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)

at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)

at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177)

at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)

at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)

at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:674)

at org.hibernate.internal.SessionImpl.save(SessionImpl.java:666)

at org.hibernate.internal.SessionImpl.save(SessionImpl.java:661)

at com.ss.entity.test.add(test.java:24)

at com.ss.entity.test.main(test.java:14)


正在回答

1 回答

要么是映射文件的问题,要么是javaBean(实体类)的问题,仔细察看,是否路径不对,或者属性的名字写错了

0 回复 有任何疑惑可以回复我~
#1

Xiangze丶Liang 提问者

非常感谢!
2016-11-29 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Hibernate初探之一对多映射
  • 参与学习       42171    人
  • 解答问题       295    个

Hibernate中一对多关联映射配置,以及cascade和inverse属性作用

进入课程

org.hibernate.MappingException: Unknown entity: com.ss.entity.Grade?有朋友知道这是什么问题吗?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信