Home  >  Forum  >  Hibernate
Post New Query

org.hibernate.MappingException: Unknown entity



Asked on May 12, 2013
Hi All ,
I am stuck with below error.

Exception in thread "main" org.hibernate.MappingException: Unknown entity: com.test.persistence.MyClass
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:704)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1475)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:705)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:693)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:689)





Replied on May 12, 2013
It seems that you have not configured  com.test.persistence.MyClass in hibernate.cfg.xml. Hibernate will not consider any entity if it is not configured in hibernate.cfg.xml


Write Answer








©2019 concretepage.com | Privacy Policy | Contact Us