-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Saving using Bidirectional Many-to-Many Collections
PostPosted: Fri Jul 29, 2005 5:50 am 
Newbie

Joined: Wed Jul 20, 2005 6:08 am
Posts: 8
Hibernate version:
Using Hibernate 2.x

I have two classes Student and Exam, i develop list of Student's booking exams with a bidirectional many-to-many collection.

I wrote on this forum for correct mapping, and according to posts i adjust the mapping between two class, but now hibernate don't save on MySQL-server the result.

At run-time exam is added on Student's list "bookings", and student is added on list of Exam "booked".

On show_sql there are the select to create the 2 instaces, and following select to inizialize collections, but insert query don't appear.

I have another bidirectional many-to-many collection and i haven't problems with its, i can do select, insert and update operations. I copied the mapping of this functional mapping on unfuncitonal mapping, but the result doesn't change.

Thank to help.

Mapping documents:
public class Exam ...{

private List booked

hibernate.bag name="booked" table="booking" cascade="save-update" lazy="true"
hibernate.collection-key column="exam"
hibernate.collection-many-to-many class="org.equinox.model.bo.StudentBO" column="student"
...
}


public class Student ...{

private List bookings

hibernate.bag name="bookings" table="booking" cascade="save-update" lazy="true" inverse="true"
hibernate.collection-key column="student"
hibernate.collection-many-to-many class="org.equinox.model.bo.ExamBO" column="exam"

}


Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):
Hibernate: select exambo0_.oid as oid0_, exambo0_.course as course0_, exambo0_.examdate as examdate0_, exambo0_.examloc as examloc0_, exambo0_.sexamdate as sexamdate0_, exambo0_.sexamloc as sexamloc0_, exambo0_.notes as notes0_ from exam exambo0_ where exambo0_.oid=?

Hibernate: select studentbo0_.oid as oid0_, studentbo0_.id as id0_, studentbo0_.email as email0_, studentbo0_.tutor as tutor0_, studentbo0_.stage as stage0_, studentbo0_.username as username0_, studentbo0_.pwd as pwd0_, studentbo0_.name as name0_,studentbo0_.surname as surname0_, studentbo0_.role as role0_, studentbo0_.active as active0_ from user studentbo0_ where studentbo0_.oid=?

Hibernate: select bookings0_.exam as exam__, bookings0_.student as student__ from booking bookings0_ where bookings0_.student=?
Hibernate: select booked0_.student as student__, booked0_.exam as exam__ from booking booked0_ where booked0_.exam=?

Hibernate: select studentbo0_.oid as oid0_, studentbo0_.id as id0_, studentbo0_.email as email0_, studentbo0_.tutor as tutor0_, studentbo0_.stage as stage0_, studentbo0_.username as username0_, studentbo0_.pwd as pwd0_, studentbo0_.name as name0_,studentbo0_.surname as surname0_, studentbo0_.role as role0_, studentbo0_.active as active0_ from user studentbo0_ where studentbo0_.oid=?

Hibernate: select coursebo0_.oid as oid0_, coursebo0_.aa as aa0_, coursebo0_.cdl as cdl0_, coursebo0_.year as year0_, coursebo0_.term as term0_, coursebo0_.cfu as cfu0_, coursebo0_.related as related0_, coursebo0_.props as props0_, coursebo0_.suggprops as suggprops0_, coursebo0_.descr as descr0_, coursebo0_.progr as progr0_, coursebo0_.sid
as sid0_, coursebo0_.name as name0_ from infoservice coursebo0_ where coursebo0_.oid=?


Debug level Hibernate log excerpt:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.