我在表中插入几行,我不知道为什么插入的行不按插入顺序-
这是java代码 -
for (Entry<Integer, String> entry : treeMap.entrySet()) {
System.out.println("Key: " + entry.getKey() + ". Value: " + entry.getValue());
insert(entry.getKey(), entry.getValue()); //method to insert a single record
}
插入查询:
insert into heightList(heightId,height) values(?,?)
sysout
日志是:(按顺序打印所有键)
Key: 1. Value: some text
Key: 2. Value: some text
Key: 3. Value: some text
Key: 4. Value: some text
Key: 5. Value: some text
Key: 6. Value: some text
Key: 7. Value: some text
Key: 8. Value: some text
Key: 9. Value: some text
Key: 10. Value: some text
Key: 11. Value: some text
Key: 12. Value: some text
Key: 13. Value: some text
Key: 14. Value: some text
Key: 15. Value: some text
Key: 16. Value: some text
Key: 17. Value: some text
Key: 18. Value: some text
Key: 19. Value: some text
Key: 20. Value: some text
Key: 21. Value: some text
Key: 22. Value: some text
Key: 23. Value: some text
Key: 24. Value: some text
Key: 25. Value: some text
Key: 26. Value: some text
Key: 27. Value: some text
Key: 28. Value: some text
Key: 29. Value: some text
Key: 30. Value: some text
Key: 31. Value: some text
Key: 32. Value: some text
Key: 33. Value: some text
Key: 34. Value: some text
Key: 35. Value: some text
Key: 36. Value: some text
Key: 37. Value: some text
但这是插入后我的表格的样子 -
heightId height
1 some text
10 some text
11 some text
12 some text
13 some text
14 some text
15 some text
16 some text
17 some text
18 some text
19 some text
2 some text
20 some text
21 some text
22 some text
23 some text
24 some text
25 some text
26 some text
27 some text
28 some text
29 some text
3 some text
30 some text
31 some text
32 some text
33 some text
34 some text
35 some text
36 some text
37 some text
4 some text
5 some text
6 some text
7 some text
8 some text
9 some text
为什么行不按顺序排列,如何按顺序插入?