Saturday 5 November 2022

org.hibernate.InstantiationException: Unable to locate constructor for embeddable

I got this error, when the embeddable class do not have a default constructor. Resolved this problem by having a default constructor in Embeddable class.

@Embeddable
public class Name {

    private String firstName;

    private String middleName;

    private String lastName;
    
    public Name() {}

    public Name(String firstName, String middleName, String lastName) {
        this.firstName = firstName;
        this.middleName = middleName;
        this.lastName = lastName;
    }

    ..........
    ..........
}

 You can download the complete working application from this link.


 

Previous                                                    Next                                                    Home

No comments:

Post a Comment