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
|