-->
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: Implement Ranking system
PostPosted: Mon Aug 02, 2010 11:10 am 
Newbie

Joined: Mon Aug 02, 2010 10:56 am
Posts: 6
Hi, I have a problem implementing a ranking system for my users.
User are ranked for an amount of points and I wanted to "accelerate" queries regarding the rank so I did a separate table like this:
Code:
public class UserRanking{
   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   private Long rank;
   
   @OneToOne
   private User user;
   
   @Column
   private Long points;


I delete records and next bulkupdate the table with an insert into statement once every 5 minutes using hibernatetemplate.updateBatch method.
Obviously, this strategy needs a reset of the value generator. I'm not sure this is the best approach for a ranking.
Any solutions on this? A better approach?

I thought on putting the rank in the user object and updating each record, but it may be very slow and querying the table with 'order by rank' may also be slow.

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Implement Ranking system
PostPosted: Tue Aug 03, 2010 4:21 pm 
Newbie

Joined: Mon Aug 02, 2010 10:56 am
Posts: 6
Nothing??


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.