I use Hibernate with Java.
Hello I have two tables which are associated with foreign keys.
Table: country
Fields: ID, Name
POJO class name : Country
POJO class properties: id, name, cities
Table: city
Fields: ID, Name, CountryID
POJO class name : Country
Then I use “hibernate reverse engineering” of MyEclipse. It creates DAOs, abstracts and pojo classes automatically.
Everything works very well. When I request a Country object, Hibernate retrieves it and fills the property “cities” with cities which has CountryID as country.id.
Still everything fine but when I list “cities” property (java Set type), then print out IDs of all cities I got this unordered list:
ID: 5
ID: 1
ID: 4
ID: 2
I don’t know where should I edit to get an ID ordered cities when I obtained Country instances from CountryDAO class.
Please help me ASAP! :'(