Home  >  Forum  >  Hibernate
Post New Query

org.hibernate.InstantiationException:No default constructor for entity


joined on
April 07,2013
Asked on May 12,2013
Hi All,

Need help for the below error. I am new to hibernate. I am making an entity and trying to save data by that entity.

Exception in thread "main" org.hibernate.InstantiationException: No default constructor for entity: 
at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:107)
at org.hibernate.tuple.component.AbstractComponentTuplizer.instantiate(AbstractComponentTuplizer.java:102)
at org.hibernate.type.ComponentType.instantiate(ComponentType.java:510)
at org.hibernate.type.ComponentType.deepCopy(ComponentType.java:429)
at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:432)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:303)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:144)
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)

joined on
March 18,2013
Replied on May 12,2013

Sweta, you need to create a constructor with no argument. This is  because you have created any constructor with argument.

Write Answer



Sitewide-Feb4of4234x60





Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us