Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002033 [Resin] major always 10-01-07 04:30 10-01-07 12:17
Reporter plehov View Status public  
Assigned To westrupp
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.3 Product Version 3.1.2
  Product Build
Summary 0002033: Amber One2Many and Many2Many relations doesn't work
Description Amber One2Many and Many2Many relations doesn't work on Resin 3.1.1, 3.1.2 and latest snapshot.
 
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0002319)
westrupp
10-01-07 12:17

Amber is working fine. The OneToMany/ManyToMany examples have been updated. Both servlets need a transaction enclosing the query and the getCourses()/getStudents() calls. Otherwise, the query would return detached entities and any attempt to retrieve the relations would return empty collections.

// ManyToManyServlet.java
...
  public void service(HttpServletRequest req, HttpServletResponse res)
    throws java.io.IOException, ServletException
  {
    // ...

    try {
      _entityManager.getTransaction().begin();

      Query allStudent = _entityManager.createQuery("SELECT o FROM Student o");

      List students = allStudent.getResultList();

      for (int i = 0; i < students.size(); i++) {
        Student student = (Student) students.get(i);

        out.println("<h3>" + student.getName() + "</h3>");

        Collection courses = student.getCourses();

        // ...
      }
    } finally {
      _entityManager.getTransaction().commit();
    }
  }
 

- Issue History
Date Modified Username Field Change
10-01-07 04:30 plehov New Issue
10-01-07 11:25 westrupp Status new => assigned
10-01-07 11:25 westrupp Assigned To  => westrupp
10-01-07 12:17 westrupp Status assigned => closed
10-01-07 12:17 westrupp Note Added: 0002319
10-01-07 12:17 westrupp Resolution open => fixed
10-01-07 12:17 westrupp Fixed in Version  => 3.1.3


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker