This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Resilient Oracle PL/SQL: Building Resilient Database Solutions for Continuous Operation and have Stephen Morris on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst
  • Peter Rooke
  • Mikalai Zaikin
  • Himai Minh

Hibernate: Many-to-many bidirectional mapping. Stack Overflow

Posts: 1
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am trying a Many-to-many bidirectional mapping.

my code is

Session session = HibernateUtil.getSessionFactory().openSession();
Transaction tr = null;
ArrayList<StudentInfo> slist = new ArrayList<StudentInfo>();
ArrayList< CourseInfo>course = new ArrayList<CourseInfo>();
tr = session.beginTransaction();
slist = (ArrayList<StudentInfo>)session.createQuery("from student.StudentInfo where sid = " +sid).list();
if(slist == null)
System.out.println("slist = null");
System.out.println("slist not null");
StudentInfo stud = slist.get(0);
for(int i = 0; i < co.length; i++)
int cid = Integer.parseInt(co[i]);
course = (ArrayList<CourseInfo>)session.createQuery("from course.CourseInfo where cid = " +cid).list();
CourseInfo cou = course.get(0);

This code works fine that entry is made in database but while printing course it gives Stack over flow error

1) i am printing student info with course where course is set it gives error when it encounter getCourse() method

Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"co" that is in your for loop is not defined in your code. Please show us all your code and put it in a code block so we can read it easier.
Quick! Before anybody notices! Cover it up with this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic