• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

I try to get whole row from database but...

 
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends,
I try to get whole row but I guess it returns just the last row!!!
Could you please help me?
Thanks,
Elahe
------------
rs =stmt.executeQuery("select s.text,b.bugNumber,b.bdesc,b.submittedDate,b.contact,u.name from bug b, user u, statusDesc s where b.ID=s.ID and b.userId=u.userId and s.text='open'");

/* walk the ResultSet and populate the vector with rows of objects */
ResultSetMetaData rsmd = rs.getMetaData();

while (rs.next()) {
C_BugList xobj=new C_BugList();
xobj.setStatus(rs.getString("text"));
xobj.setBugNumber(rs.getInt("bugNumber"));
xobj.setBdesc(rs.getString("bdesc"));
xobj.setSubmittedDate(rs.getString("submittedDate"));
xobj.setContact(rs.getString("contact"));
xobj.setName(rs.getString("name"));
ctx.put("name", xobj );
}
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is probably your problem

You create a new instance of your BugList object and store it in the collection using the key "name". Because you keep using the same key you will just store the last object. See Map.put(...) in the JDK JavaDoc.
You probably want to do something like
reply
    Bookmark Topic Watch Topic
  • New Topic