3

I am fetching entries from a table using findAll of Spring JPA, and I am using only one of the entries. In one of the environment the returned entries are like A,B,C in that order, but in another environment the order returned is B,A,C

The environments do not differ in a way that it may effect. Both of them have the same table, completely same as each other. The code is the same as well.

prat desh
  • 31
  • 2
  • 5
    There is no default order. It is up to the database to return the data. – M. Deinum Mar 03 '20 at 11:47
  • 1
    As @M.Deinum stated it up to the database, most of the database do not guarantee the order of record returned on a select query without `order by` clause. If order is necessary use order by. For spring JPA check https://stackoverflow.com/questions/25486583/how-to-use-orderby-with-findall-in-spring-data – seenukarthi Mar 03 '20 at 11:52

0 Answers0