Halo, hibernate Merge and cascade= "All-delete-orphan" should be carefully combined to use

Source: Internet
Author: User

Encountered a more regretful thing, using Hibernate's merge and cascade= "All-delete-orphan", the child table data was deleted.


1, use cascade= "All-delete-orphan" To do the cascade delete operation, but please be careful and gethibernatetemplate (). Merge (entity), parameters used together, when using such a combination,

Hibernate executes the gethibernatetemplate (). Merge (entity), performs an update or a save operation, but immediately deletes the data associated with the table.

Hibernate would auto remove all the relationships,

My rub .... , puzzled Ah,




2.

Hibernate:update Wf_plan_book set train_dep=?, user_id=?, training_son_type=?, Forsecast_class_time=?, TRAINING_START _time=, training_main_type=?, review_cost_arrears=?, recived_dep=?, training_grandson_type=?, TIME_PLAN=?, TEACHER_ Name=, rmark=?, Class_name=?, Training_class_name=, cost_standard=?, Training_end_time=, student_type=?, MANAGER_ People=, plan_project_nu=?, runid=?, number_of_student=?, total_revenue=?, dep_cost_received=?, FINANCIAL_COST_ Received=, cost_arrears=, appraise_cost_recived=?, appraise_cost_arrears=?, review_cost_recived=?, INCOME_COST=? Pay_cost=, training_cost_remuneration=?, training_cost_book=?, training_cost_dining=?, TRAINING_COST_CONSUME=?, Total_appraise_pay=, appraise_pay_book=?, appraise_pay_remuneration=?, appraise_pay_dining=?, APPRAISE_PAY_ Consume=, appraise_pay_spot=, boundary_benefit=?, graduate_people=?, material=?, material_student_people=? Material_graduate_people=, balance=?, appraise_balance=?, total_pay=?, unit_number=?, Not_Unit_number=, unit_revenue=?, not_unit_revenue=, class_number=?, day_person_number=?, plan_book_fileids=?, process _flag=, process_sign=?, monthly=?, training_card_number=?, received_train_cost=?, received_review_cost=?, RECEIVED_ Appraisal_cost=, total_review_pay=?, is_train_class=?, is_closed=? where mainid=?
Hibernate:delete from Tbl_financial_pay where financial_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_consumption_pay where consumption_pay_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Tbl_student_info_pay where student_id=?
Hibernate:delete from Wf_teacher_remuneration where mainid=?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.