org.hibernate.InstantiationException: No default constructor for entity: : principal.Cliente

We Are Going To Discuss About org.hibernate.InstantiationException: No default constructor for entity: : principal.Cliente. So lets Start this Java Article.

org.hibernate.InstantiationException: No default constructor for entity: : principal.Cliente

  1. org.hibernate.InstantiationException: No default constructor for entity: : principal.Cliente

    Missing default constructor in principal.Cliente I can say,
    public class Cliente{ public Cliente(){} }

  2. org.hibernate.InstantiationException: No default constructor for entity: : principal.Cliente

    Missing default constructor in principal.Cliente I can say,
    public class Cliente{ public Cliente(){} }

Solution 1

Missing default constructor in principal.Cliente I can say,

public class Cliente{ 
  public Cliente(){}
}

Original Author Arpit Aggarwal Of This Content

Solution 2

when you are adding more constructors, make sure to keep the default one.

public Cliente(){
   super()
}

Original Author pradeep karunathilaka Of This Content

Solution 3

The easiest way to get rid of this error in spring boot is to use the @NoArgsConstructor annotation. For this you will need lombok dependency.I always recommend to use lombok in spring boot projects. Then your entity class will be as follows

import lombok.NoArgsConstructor;

    @Entity
    @NoArgsConstructor
    public class Cliente{ 
      
    }

Original Author Roshinie Jayasundara Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment