Hi Guys,
I am trying to execute the below code
trans = ses.beginTransaction();
Meeting met=new Meeting();
MeetingKey key = new MeetingKey();
key.setCaseId("test");
key.setEventSeq(1);
key.setGroupSeq(1);
key.setParticipantId(1);
key.setMeetingSeq(1);
met.setKey(key);
met.setName("Testname");
met.setMeetingDate(new Date());
met.setTime("12:00");
ses.update(met);
trans.commit();
The following two sql queries are generated in the backend.
update meeting set meeting_title=?, meeting_date=?, time_of_day=? where case_id=? and event_seq=? and group_seq=? and participant_id=? and meeting_seq=?
delete from meeting_individual where case_id=? and event_seq=? and group_seq=? and participant_id=? and meeting_seq=?
can any one tell me, why i am getting this delete query. I have given cascade="none" in my mapping document.
Hibernate version: Hibernate 3.1.2
Mapping documents: <class name="Meeting" table="meeting" lazy="false"> <composite-id name="key" class="MeetingKey"> <key-property name="caseId" type="string" column="case_id"/> <key-property name="eventSeq" type="integer" column="event_seq"/> <key-property name="groupSeq" type="integer" column="group_seq"/> <key-property name="participantId" type="integer" column="participant_id"/> <key-property name="meetingSeq" type="integer" column="meeting_seq"/> </composite-id> <property name="name" type="string" column="meeting_title"/> <property name="meetingDate"> <column name="meeting_date" sql-type="date" ></column> </property> <property name="time" type="string" column="time_of_day"/> <!-- <many-to-one name="chronologyText" class="ChronologyText" column="description_text_id" unique="true"/> --> <bag name="attendees" table="meeting_individual" fetch="join" cascade="none"> <key> <column name="case_id"></column> <column name="event_seq"></column> <column name="group_seq"></column> <column name="participant_id"></column> <column name="meeting_seq"></column> </key> <many-to-many class="Individual" fetch="join"> <formula>case_id</formula> <formula>event_seq</formula> <formula>group_seq</formula> <formula>participant_id</formula> <column name="individual_seq"></column> </many-to-many> </bag> </class>
Code between sessionFactory.openSession() and session.close(): trans = ses.beginTransaction(); Meeting met=new Meeting(); MeetingKey key = new MeetingKey(); key.setCaseId("test"); key.setEventSeq(1); key.setGroupSeq(1); key.setParticipantId(1); key.setMeetingSeq(1); met.setKey(key); met.setName("Testname"); met.setMeetingDate(new Date()); met.setTime("12:00"); ses.update(met); trans.commit();
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true): update meeting set meeting_title=?, meeting_date=?, time_of_day=? where case_id=? and event_seq=? and group_seq=? and participant_id=? and meeting_seq=? delete from meeting_individual where case_id=? and event_seq=? and group_seq=? and participant_id=? and meeting_seq=?
Debug level Hibernate log excerpt:
with thanks,
krishna
|