Those are my classes:
@Entity
@Table(name="assessment")
public class AssesmentProperties {
@Id
@Column(name="AssessmentId")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long AssessmentId;
@Column(unique=true,nullable=false)
private String AssessmentName;
private String AssessmentLevel;
private String Specialization;
private int time;
private String keywords;
private int NoOfSections;
//getters and setters
}
@Embeddable
public class SettingsPrimary implements Serializable {
private Long AssessmentId;
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long Section;
//getters and setters
}
@Entity
@Table(name="section")
public class SectionProperties {
@EmbeddedId
private SettingsPrimary PrimaryKey;
private String SectionType;
private int Weightage;
private int time;
private int NoOfQuestions;
//getters and setters
}
In the table section I need to create assessment_id as FK to assessment table and set cascade on delete. I have tried to do it with different ways but without success.
AssesmentProperties? You can set the cascade in the@OneToOneor@ManyToOneannotation usingcascade=