I am using hibernate 4.2.21 version. I have partial entities and I used @Embedded and @Embeddable annotations. When trying to run project , it gives an exception;
property mapping has wrong number of columns: com.demo.School.teacher type: object
School entity class
@Entity(name = "School")
public class{
public String schoolId;
public String schoolName;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "teacherName",column = @Column(name = "teacherName")),
@AttributeOverride(name = "teacherPhone",column = @Column(name = "teacherPhone")),
})
@XmlElements({
@XmlElement(name = "TeacherU", type = TeacherU.class),
@XmlElement(name = "TeacherH", type = TeacherH.class)
})
public object teacher;
//getters and setters
}
Teacher (University) entity class
@Embeddable
public class TeacherU {
public String teacherName;
public String teacherPhone;
//getters and setters
}
Teacher (High School) entity class
@Embeddable
public class TeacherH {
public String teacherName;
public String teacherPhone;
//getters and setters
}