-->
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.  [ 3 posts ] 
Author Message
 Post subject: Simulating NetFlix's user ordered queue
PostPosted: Fri Dec 22, 2006 11:23 am 
Newbie

Joined: Mon Nov 13, 2006 12:43 pm
Posts: 11
Location: US
Hi folks!

I have a (perhaps simple) question about collections. I have read past threads, and NHibernate documentation, but unsure of what is the best way to proceed. Any pointers would be greatly appreciated.

Scenario:

Basically, I have a collection that is ordered by the user. The default order should be the order, in which the user added items to the collection. But, then, user should have a ability to change the order based on his wishes. (Think of NetFlix.com’s movie queue).

Thanks in advance!
desiguy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 2:58 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
You just need to implement a list with a sequence. Then use the sequence to control the order. Basically the sequence will be managed for you by NHibernate. The sequence will be determined by the order of the items in the list.

So if a user moves an item from index 5 to say index 3, your code would remove the element from index 5 and insert it into index 3.

Previously I have created wrapper classes that expose a Move operation that will handle all the internals for you and the caller only has to know that they should execute the Move operation.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 3:28 pm 
Newbie

Joined: Mon Nov 13, 2006 12:43 pm
Posts: 11
Location: US
Hi Jnapier,

Could you share some code that you are talking about?

Thanks,
Desiguy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.