Beginner |
|
Joined: Tue Aug 26, 2003 11:33 pm Posts: 38
|
I have two classes like the following. When I delete a catalog, I got this strange error:
hibernate exception caught! Unexpected exception: Failed to lazily initialize a collection: exception setting property value with CGLIB setter of hibernate.QuestionObjective.?
I don't understand what it means. Anyone can help ? Thanks a lot !
/**
* @hibernate.class
* table="catalog"
* mutable="true"
* proxy="hibernate.Catalog"
*/
public class Catalog {
private long id;
private String name;
private String iconUrl;
private Catalog catalog;
private Set subCatalogs;
private Set objectiveQuestions;
private Set subjectiveQuestions;
/**
* @hibernate.id
* column="id"
* unsaved-value="null"
* generator-class="native"
* @return
*/
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
/**
* @hibernate.property
* column="name"
* not-null="false"
* unique="false"
* @return
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* @hibernate.property
* column="iconurl"
* not-null="false"
* unique="false"
* @return
*/
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
/**
* @hibernate.many-to-one
* column="pid"
* cascade="none"
* class="hibernate.Catalog"
* outer-join="false"
* unique="false"
* @return
*/
public Catalog getCatalog() {
return catalog;
}
public void setCatalog(Catalog catalog) {
this.catalog = catalog;
}
/**
* @hibernate.collection-one-to-many
* class="hibernate.Catalog"
* @hibernate.collection-key
* column="pid"
* @hibernate.set
* inverse="false"
* table="Catalog"
* lazy="true"
* cascade="delete"
* @return
*/
public Set getSubCatalogs() {
return subCatalogs;
}
public void setSubCatalogs(Set subCatalogs) {
this.subCatalogs = subCatalogs;
}
/**
* @hibernate.collection-one-to-many
* class="hibernate.QuestionObjective"
* @hibernate.collection-key
* column="cid"
* @hibernate.set
* inverse="false"
* table="objectiveQuestion"
* lazy="true"
* cascade="delete"
* @return
*/
public Set getObjectiveQuestions() {
return objectiveQuestions;
}
public void setObjectiveQuestions(Set objectiveQuestions) {
this.objectiveQuestions = objectiveQuestions;
}
/**
* @hibernate.collection-one-to-many
* class="hibernate.QuestionSubjective"
* @hibernate.collection-key
* column="cid"
* @hibernate.set
* inverse="false"
* table="subjectiveQuestion"
* lazy="true"
* cascade="delete"
* @return
*/
public Set getSubjectiveQuestions() {
return subjectiveQuestions;
}
public void setSubjectiveQuestions(Set subjectiveQuestions) {
this.subjectiveQuestions = subjectiveQuestions;
}
}
---------
/**
* @hibernate.class
* table="objectiveQuestion"
* mutable="true"
* proxy="hibernate.QuestionObjective"
*/
public class QuestionObjective {
private long id;
private String content;
private String filename;
private String instruction;
private String correctAnswer;
private Catalog catalog;
private QuestionType type;
private HardLevel level;
private int hits;
private Set tests;
public QuestionObjective() {
}
/**
* @hibernate.id
* column="id"
* unsaved-value="null"
* generator-class="native"
* @return
*/
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
/**
* @hibernate.property
* column="content"
* not-null="false"
* unique="false"
* @return
*/
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
/**
* @hibernate.property
* column="filename"
* not-null="false"
* unique="false"
* @return
*/
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
/**
* @hibernate.property
* column="instruction"
* not-null="false"
* unique="false"
* @return
*/
public String getInstruction() {
return instruction;
}
public void setInstruction(String instruction) {
this.instruction = instruction;
}
/**
* @hibernate.property
* column="correctanswer"
* not-null="false"
* unique="false"
* @return
*/
public String getCorrectAnswer() {
return correctAnswer;
}
public void setCorrectAnswer(String correctAnswer) {
this.correctAnswer = correctAnswer;
}
/**
* @hibernate.many-to-one
* column="cid"
* cascade="none"
* class="hibernate.Catalog"
* outer-join="false"
* unique="false"
* @return
*/
public Catalog getCatalog() {
return catalog;
}
public void setCatalog(Catalog catalog) {
this.catalog = catalog;
}
/**
* @hibernate.many-to-one
* column="typeid"
* cascade="none"
* class="hibernate.QuestionType"
* outer-join="false"
* unique="false"
* @return
*/
public QuestionType getType() {
return type;
}
public void setType(QuestionType type) {
this.type = type;
}
/**
* @hibernate.many-to-one
* column="lid"
* cascade="none"
* class="hibernate.HardLevel"
* outer-join="false"
* unique="false"
* @return
*/
public HardLevel getLevel() {
return level;
}
public void setLevel(HardLevel level) {
this.level = level;
}
/**
* @hibernate.property
* column="hits"
* not-null="false"
* unique="false"
* @return
*/
public int getHits() {
return hits;
}
public void setHits(int hits) {
this.hits = hits;
}
/**
* @hibernate.collection-many-to-many
* column="tid"
* class="hibernate.Test"
* @hibernate.set
* inverse="true"
* table="testObjectiveQuestionRelation"
* lazy="true"
* cascade="none"
* @hibernate.collection-key
* column="qid"
* @hibernate.collection-index
* column="qid"
* @return
*/
public Set getTests() {
return tests;
}
public void setTests(Set tests) {
this.tests = tests;
}
}
----
/**
* @hibernate.class
* table="subjectiveQuestion"
* mutable="true"
* proxy="hibernate.QuestionSubjective"
*/
public class QuestionSubjective {
private long id;
private String content;
private String filename;
private String keypoints;
private Catalog catalog;
private HardLevel level;
private QuestionType type;
private int hits;
private Set tests;
public QuestionSubjective() {
}
/**
* @hibernate.id
* column="id"
* unsaved-value="null"
* generator-class="native"
* @return
*/
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
/**
* @hibernate.property
* column="content"
* not-null="false"
* unique="false"
* @return
*/
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
/**
* @hibernate.property
* column="filename"
* not-null="false"
* unique="false"
* @return
*/
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
/**
* @hibernate.property
* column="keypoints"
* not-null="false"
* unique="false"
* @return
*/
public String getKeypoints() {
return keypoints;
}
public void setKeypoints(String keypoints) {
this.keypoints = keypoints;
}
/**
* @hibernate.many-to-one
* column="cid"
* cascade="none"
* class="hibernate.Catalog"
* outer-join="false"
* unique="false"
* @return
*/
public Catalog getCatalog() {
return catalog;
}
public void setCatalog(Catalog catalog) {
this.catalog = catalog;
}
/**
* @hibernate.many-to-one
* column="lid"
* cascade="none"
* class="hibernate.HardLevel"
* outer-join="false"
* unique="false"
* @return
*/
public HardLevel getLevel() {
return level;
}
public void setLevel(HardLevel level) {
this.level = level;
}
/**
* @hibernate.many-to-one
* column="typeid"
* cascade="none"
* class="hibernate.QuestionType"
* outer-join="false"
* unique="false"
* @return
*/
public QuestionType getType() {
return type;
}
public void setType(QuestionType type) {
this.type = type;
}
/**
* @hibernate.property
* column="hits"
* not-null="false"
* unique="false"
* @return
*/
public int getHits() {
return hits;
}
public void setHits(int hits) {
this.hits = hits;
}
/**
* @hibernate.collection-many-to-many
* column="tid"
* class="hibernate.Test"
* @hibernate.set
* inverse="false"
* table="testSubjectiveQuestionRelation"
* lazy="true"
* cascade="none"
* @hibernate.collection-key
* column="qid"
* @hibernate.collection-index
* column="qid"
* @return
*/
public Set getTests() {
return tests;
}
public void setTests(Set tests) {
this.tests = tests;
}
}
|
|