-->
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: Many to many relationship - Tricky one
PostPosted: Thu Nov 10, 2011 8:00 am 
Newbie

Joined: Thu Sep 22, 2011 11:58 pm
Posts: 3
Hi,

I created the following table in oracle and mysql
- Student(student_id,student_name) with primary_key(student_id)
- Course(course_id,course_name) with primary key(course_id)
- Student_course(student_id,course_id) with primary_key(student_id,course_id)

The following is the hibernate mappings file generated for student in both mysql and oracle (10g),however I just manually added the cascade="all"

<hibernate-mapping>
<class name="com.test.Student" table="student">
<id name="studentId" type="java.lang.Integer">
<column name="student_id" />
<generator class="identity" />
</id>
<property name="studentName" type="string">
<column name="student_name" length="100" />
</property>
<set name="courses" table="student_course" inverse="false" lazy="true" fetch="select" cascade="all">
<key>
<column name="student_id" not-null="true" />
</key>
<many-to-many entity-name="com.test.Course">
<column name="course_id" not-null="true" />
</many-to-many>
</set>

</class>
</hibernate-mapping>

The cascading and retrieval of course set works(i.e inserts/selects to/from student, course, student_course) fine in mysql but never works for oracle.In Oracle it inserts record in student and course but never into student_course and the retrieval never works. I just wanted to know what is different in execution of hibernate for mysql versus oracle?
Any comments / suggestion welcomed.

Thanks,
bkhe


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.