-->
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: Best practice for generating a table of statistics
PostPosted: Wed Nov 19, 2003 5:49 pm 
Beginner
Beginner

Joined: Wed Oct 15, 2003 3:08 pm
Posts: 32
I have a service that prepares a table (not persisted) of statistics generated from 4 persisted tables.

Currently, I am approaching this by implementing a view in my database that will get the statistics in a very optimal way. Then I plan to map the view to an object so that I can easy obtain the objects, page, and sort using Hibernate.

Alternatively, I could do this all with the domain objects. However, due to the calculations and the sheer number of objects this appears to be roughly 10 times as slow in Hibernate 2.0.3. Of course, this is not a fault in Hibernate.

My question is: is this considered a best practice? On one side I am gaining significant performance, on the other I am losing some of the nice database abstraction and caching I get from Hibernate.

It seems to me that I should leverage Hibernate wherever possible and only do this view approach when I can get significant performance improvements. However, I am curious about the experience of other Hibernate users and developers.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 5:57 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The approach should be: Let the database do what it is good at. This means, if a View is the best for your use case and you don't have any portability problems or don't want to update the data, use it.

Your data and database schema will propably outlive the Java application or even Java. :)

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.