MySQL Forums
Forum List  »  Connector/JDBC and Java

ORDER BY query
Posted by: Adrián Córdoba
Date: September 07, 2016 11:54AM

Hi, there!
For two days, I'm struggling with this problem:
I'm developing a Java application.
The program shows an ordered list of objects in a Swing JList. These objects are obtained with a SQL query (SELECT.....ORDER BY...) to a MySQL database.
The user can add an object. This object is inserted on database by mean of "INSERT INTO....".
After the object is inserted in database, the JList is cleared, and the same "SELECT....ORDER BY...." query is executed in order to populate the JList again.
But the added object appears at the end of the list, instead it appear in order.
After I restart the application, the added object appears in correct order.
I can't imagine why this happens.
I don't know SQL and MySQL very well. May be I'm omitting some statements for persists the changes in database... I don't know.

Can sombody help me with this problem?

Thank you, in advance.

Options: ReplyQuote


Subject
Written By
Posted
ORDER BY query
September 07, 2016 11:54AM
September 13, 2016 03:39AM
October 17, 2016 11:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.