Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

Hibernate List question

 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am looking for suggestions on what is the best way to implement a hibernate collection. I have a column called" "SeqNBR" which indicates the location of the element in the collection.

An element in the collection is allowed to move from its position. My application needs that flexibility.

If I use the traditional ArrayList to implement this I could get the change in position and go through the list and change the sequence number for each of the elements affected. But it seems very inefficient.

The other implementation is use a Linked List. Here I can simply to move an elements I remove it from its original position and add it to its new location. But some how I think this is way to simple and I am missing something.

The last is use a sorted set (sorted using the sequence numbers) instead of a list and change the sequence numbers as and when elements are moved.

I am confused as to which is the better implementation or I am totally off base here and there is a different way of doing these things.

I would appreciate any help.

Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Ankur, please check your private messages.
 
    Bookmark Topic Watch Topic
  • New Topic