• Post Reply Bookmark Topic Watch Topic
  • New Topic

will vector handles the objects in orderwise  RSS feed

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey here i am developing one application which gets the values from the database (mysql server)

there are 1000's of records to be fetched from the database and i am handling it in a vector ,so the problem is it is retrieving all the records but when i display it from the vector it is not displaying orderwise

anyone experienced these kind of problem?
 
Srikanth Basa
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you did not use ORDER BY in the your SELECT query.

Can you post the code ?
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no no i have used order by in the select statement
 
Srikanth Basa
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by saikrishna cinux:
no no i have used order by in the select statement


Then I'm confident that you might be messing up the contents of the Vector.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by saikrishna cinux:
no no i have used order by in the select statement


SQL does not guarentee any ordering of result sets unless you specify one with an order by clause. Either specify an order by to enforce the ordering you want, or sort the Vector, if your ordering rules are too complex to be feasable in SQL.
 
amit indian
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please paste your query.

is it just returning one string that you are storing in a vector?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Vector class certainly should preserve the order. As should ArrayList, for code written during the current millenium.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!