Tag Archives: HibernateNo default constructor for entity

Hibernate:No default constructor for entity [How to Solve]

error:

org.hibernate.InstantiationException: No default constructor for entity: com.tks.skyproject.model.ImplementLogAttach
at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:90)
at org.hibernate.tuple.PojoInstantiator.instantiate(PojoInstantiator.java:106)
at org.hibernate.tuple.AbstractEntityTuplizer.instantiate(AbstractEntityTuplizer.java:344)
at org.hibernate.persister.entity.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:3272)
at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1239)
at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1228)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1291)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)

Error Analysis: Something went wrong with the constructor, and the default constructor was deleted in the class.

Error solution.

 

Go to the class and write.

// Construct the parameterless constructor

public AbstractUser() {}