开发者

Hibernate : self reference FK in same table as well as different table

I have 2 tables as below

historyQuestions
=====================
开发者_如何学Goquestion_id bigint(2) PK
question_master_id bigint(2) fk references question_master(question_id)
parent_question_id bigint(2) fk references historyQuestions(question_id)
parent_answer_id bigint(2) fk references historyAnswers(answer_id)

historyAnswers
=====================
answer_id bigint(2) pk
question_id bigint(2) fk references historyQuestions(question_id)
answer_master_id bigint(2) fk references answer_master(answer_id)

Now I want to newly insert records using hibernate

session.save(entityObj)

but it gives me

exception org.hibernate.StaleStateException

Any help would be appriciate..


COPIED DIRECTLY FROM HIBERNATE JAVADOC, please, google your exception and do some research first.

Thrown when a version number or timestamp check failed, indicating that the Session contained stale data (when using long transactions with versioning). Also occurs if we try delete or update a row that does not exist.

Note that this exception often indicates that the user failed to specify the correct unsaved-value strategy for a class!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜