-->
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.  [ 4 posts ] 
Author Message
 Post subject: how should i implement a sequence counter?
PostPosted: Fri Oct 31, 2003 3:28 am 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
i have a GalleryImage and I need to be able to scroll next and previous, how should I implement this in hibernate?

this is what I was thinking, having a column that holds "counter" so the first GalleryImage I insert for a given Gallery starts at 1, the next one added starts at 2, and so on and so fourth, but what if I have 10 GalleryImages and the 5th one is removed? there would be an empty spot.. so that idea is no good..

how should I do this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2003 3:39 am 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
I could also do a query, to give me the next object previous/next to the current GalleryImage being displayed..

I would have to use a generator that generates ids sequence from small to large.. just a thought


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2003 3:55 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
This is a pretty simple problem and doesn't relate too much to Hibernate.

However, I think that Hibernate's List one-to-many might help you keep the indexes of a particular set of images always ordered 0..n.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2003 6:36 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
just found out that i could in fact use List, was using a Set before so i didnt have an index


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