| Beginner |
 |
Joined: Tue Nov 25, 2003 3:33 pm Posts: 35
|
How do I set inverse=true on OneToMany association using annotations?
this is what my annotations look like:
Code: @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY) @JoinColumn(name="participant_id",nullable=false,insertable=true) @Cascade (value=org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
when I run creation logic there is an insert of the owned entity and then update on that owned entity to set the owner's id (see sql_show output below). I remember I used to set inverse=true to get rid of that update before, and I can not find a way to set it with annotations.
Anyone has an idea?
Thanks,
Alex.
Hibernate version: 3.1rc2
Name and version of the database you are using: Orcale 9i
The generated SQL (show_sql=true): Hibernate: select tas_seq_timeoff_snapshot.nextval from dual Hibernate: select tas_seq_timeoff_snapshot.nextval from dual Hibernate: select tas_seq_timeoff_snapshot.nextval from dual Hibernate: select tas_seq_timeoff_snapshot.nextval from dual Hibernate: select tas_seq_timeoff_snapshot.nextval from dual Hibernate: insert into tas_timeoff_snapshot (version, end_date, start_date, end_personal, end_vacation, start_personal, start_vacation, participant_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into tas_timeoff_snapshot (version, end_date, start_date, end_personal, end_vacation, start_personal, start_vacation, participant_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into tas_timeoff_snapshot (version, end_date, start_date, end_personal, end_vacation, start_personal, start_vacation, participant_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into tas_timeoff_snapshot (version, end_date, start_date, end_personal, end_vacation, start_personal, start_vacation, participant_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into tas_timeoff_snapshot (version, end_date, start_date, end_personal, end_vacation, start_personal, start_vacation, participant_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: update tas_participant set version=?, name=?, email=?, hire_date=?, pstart_date=?, group_email=?, manager_id=? where id=? and version=? Hibernate: update tas_timeoff_snapshot set participant_id=? where id=? Hibernate: update tas_timeoff_snapshot set participant_id=? where id=? Hibernate: update tas_timeoff_snapshot set participant_id=? where id=? Hibernate: update tas_timeoff_snapshot set participant_id=? where id=? Hibernate: update tas_timeoff_snapshot set participant_id=? where id=?
|
|