You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Adam Henderson Azudio <az...@hotmail.com> on 2005/03/10 16:01:01 UTC

Many To Many Associations being deleted

New problem now,

Background: Using Spring OSIV filter, Managers & DAOs subclassing 
HibernateDAOSupport

I've got a many to many association between Course and Courselesson, 
there is one Course and one Courselesson in the DB, their associations 
are held in a link table:

courselessons_in_course
course_fk			1	
courselesson_fk	9

I can retrieve and edit the Course (id 1), with no problems an update 
is issued to Course. If I edit the Courselesson (id 9) and save, 
hibernate has the great idea of deleting the all rows from 
courses_in_courselessons where courselesson_fk = 9, destroying all the 
associations.

cascade is off on both ends, only one end is inverse="true" (no matter 
what end, exactly the same behaviour as above), lazy="true" on both 
ends.

Why? Ive tried shouting at it and it's still not working :)


My mappings:

Courselesson xDoclet
     /**
      * @return Returns the courses.
      * @hibernate.set
      * name="courses"
      * table="courselessons_in_course"
      * lazy="true"
      *
      * @hibernate.collection-many-to-many
      * column="fk_course"
      * class="Course"
      *
      * @hibernate.collection-key
      * column="fk_courselesson"
      */
     public Set getCourses() {
         return courses;

Course xDoclet
     /**
      * @hibernate.set
      * name="courselessons"
      * table="courselessons_in_course"
      * inverse="true"
      * lazy="true"

      * @hibernate.collection-many-to-many
      * column="fk_courselesson"
      * class="Courselesson"
      *
      * @hibernate.collection-key
      * column="fk_course"
      */
     public Set getCourselessons() {
         return courselessons;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org