-->
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: Speed: store objects in hashmap by code or hsql query them
PostPosted: Thu May 22, 2008 10:03 pm 
Newbie

Joined: Tue Apr 22, 2008 12:48 am
Posts: 9
Dear all,

Up to now, in our application, every time we restart it we load all the objects from the database using a simple select hql query and then we store them in a hashmap like (code_pk,object) so we can access the object later easily...

It may look silly because... why do we store them in a hashmap, if we can use another hql query to access them like 'from obj_table where obj.code = whatever'... well, in the begging we didn't know that much of hibernate or maybe we misunderstood the concept or maybe we just did it because the old application was also storing the objects in a hashmap in a similar way.

Now that i realized we are somehow 'duplicating' the job, and i am seriously considering to remove the hashmaps and the name service and modify its access methods to replace them with hql queries, I just worried about performance.

Let me tell you that our application is based in real time. The client has to access very fast to the objects in the server and manipulate them, so i am wondering how the hql works. How the query is accessing the objects? How the hibernate stores the objects? Can it be faster than just using a hashmap? is it better optimized? As performance is the most important here, i don't care duplicating the 'job' as long as the performance is better...

In the case we decided to get rid of the name service and its hashmaps... is there a smarter way to load all the data from the tables than just few queries like: session.createQuery("from Area") to create the objects?

Anyone can give me some light about it?



Thanks,
Daniel.

Daniel F. Boada - boadadf@yahoo.com
Traffic Project Manager
Sena Traffik - www.sena.com.my
Kuala Lumpur - Malaysia


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 02, 2008 12:51 pm 
Regular
Regular

Joined: Sun Apr 13, 2008 3:04 am
Posts: 71
Location: Bangalore
Hi,

ORM layer would certainly add overhead as opposed to PURE jdbc approach. However, if you are able to controle every query (which hibernate does support) then it must be as fast as jdbc with hashmaps.

You may consder to use cache to reduce the db hits.. based on testing

B.T.W were you succefull in hashmap storing retrival using jap/hibernate annotations. If yes, pl share the example code for the same.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
Competant and Reliable Offshore Java Development Partners.


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.