-->
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.  [ 2 posts ] 
Author Message
 Post subject: Many to Many association
PostPosted: Tue Dec 11, 2007 2:26 am 
Newbie

Joined: Tue Dec 11, 2007 2:06 am
Posts: 1
getting
EXCEPTION:
ORA-00904: "ELT": invalid identifier

while persisting a SET refrence to associated object.
example:
1)---------------:classes:---------
class 1:
public class Student implements Serializable {
Integer id;
String firstName;
String lastName;
Set courses;
}
class 2:
public class Courses implements Serializable {
private int id;
private String course_name;
private Set students;
}
2)-------tables----------
table 1:
Student(studentId PK,firstName,lastName)
table 2:
Courses(courseId PK,course_name)
table 3:
StudentCourses(studentId FK STUDENT(studentId ),courseId FK COURSES(courseId),PK(studentId,courseId));

3)------------saving----------
Courses crs=new Courses();
Student s=new Student();
s.setId(10);
s.setFirstName("ABC");
s.setLastName("XYZ");

crs.setId(10);
crs.setCourse_name("J2EE");
Set set2=new TreeSet();
set2.add(s);
c.setStudents(set2);
Save(c); //exception
/////////////
4)-----------exception-------------------------------
Hibernate operation: could not insert collection: [Course.studen#10]; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-00904: "ELT": invalid identifier


Top
 Profile  
 
 Post subject: Re: Many to Many association
PostPosted: Tue Dec 11, 2007 7:33 am 
Beginner
Beginner

Joined: Wed Apr 26, 2006 4:40 am
Posts: 24
user2208 wrote:
...
Courses crs=new Courses();
...
c.setStudents(set2);
Save(c);

Sorry, what is c? Is it a typo and you meant crs?

Do you have mapping files?


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

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.