-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate selecting order
PostPosted: Fri Sep 28, 2007 4:03 am 
Newbie

Joined: Fri Sep 28, 2007 3:39 am
Posts: 3
Hi!

I 'm looking for any information regarding next problem:

Database for my application is shared for two applications: my java application and Old C++ application.

In C++ there is business logic which depends on order of reading data from db. That is: reads data from db and immediately process them. Order of readed data is natural: as they located in db.

In my java app I should implement the same functionality. But I'm not sure that read data will occurs in the same order as it was read in C++ code.
But the same order is strongly needed.

Does hibernate guarantee that selected rows of data will have the same natural order(as they wrote in db) during all requests to db?

Changing of C++ code and providing of additional sorting is already impossible because of already there is data in db which depends on already implemented algorithm.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 28, 2007 5:29 am 
Newbie

Joined: Thu Apr 26, 2007 9:42 am
Posts: 14
I don't know which db server do you use, but as I know the Oracle db doesn't guarantee the order of rows int the result set if you not specify an ORDER clause in the select. (even if you do 100 selects and it returns the same order, it's possible to have a different order at the next select).

In SQL Server the PK on a table has an associated 'clustered index' that keeps the data in the table ordered by that PK, so if there isn't an ORDER clause defined into SELECT it will returns the rows ordered by PK column/s or another column/s that have a 'clustered index' defined (it can be only one 'clustered index' defined for a table).

See the documentation for another db servers.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.