Hello I have a report and a reporter linked by a many-to-many relationship . The table between report and reporter is ext_report_reporters.
Everytime I add a new reporter to my report, hibernate will delete all the previous lines in ext_report_reporters before inserting them again even though it is creating exactly the same row as it has deleted. Anything I could turn off so it doesn't delete and recreate the same row ? This behavious is causing me problems because I have triggers on my ext_report_reporters table in insert
Thanks
Cecile
Hibernate version:
2.1.7
Code between sessionFactory.openSession() and session.close():
ReportAbstract report = new Report();
report.addReporter(getNewReporter());
tx = session.beginTransaction();
reportDAO.saveOrUpdateReport(report);
tx.commit();
assertNotNull("New report added",report.getReportId());
report.addReporter(createReporter());
tx = session.beginTransaction();
reportDAO.saveOrUpdateReport(report);
tx.commit();
Name and version of the database you are using:
oracle 9i
The generated SQL (show_sql=true):
Hibernate: select SQ_EXT_REPORTER_ID.nextval from dual
Hibernate: insert into EXT_REPORTER (OCCUPATION_CODE, ANCILLARY_DOCUMENTS_FLAG, ANCILLARY_DOCUMENT, OCCUPATION_OTHER, REPORTER_TYPE_CODE, REPORTER_SOURCE_CODE, NOTIFICATION_CODE, SPECIALITY_CODE, LAST_NAME, FIRST_NAME, ORGANISATION_NAME, LOCATION, ADDRESS_LINE1, ADDRESS_LINE2, ADDRESS_LINE3, ADDRESS_LINE4, CITY, POSTAL_CODE, COUNTRY_CODE, REGION_CODE, EMAIL_ADDRESS, FAX_NUM, PHONE_NUM, PRIMARY_REPORTER, REPORTER_DISCRIMINATOR, REPORTER_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'R', ?)
Hibernate: delete from EXT_REPORT_REPORTERS where REPORT_ID=?
Hibernate: insert into EXT_REPORT_REPORTERS (REPORT_ID, REPORTER_ID) values (?, ?)
Hibernate: insert into EXT_REPORT_REPORTERS (REPORT_ID, REPORTER_ID) values (?, ?)
Hibernate: insert into EXT_REPORT_REPORTERS (REPORT_ID, REPORTER_ID) values (?, ?)
|