-->
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: Items in Category, ordered by DISPLAY_POSITION
PostPosted: Tue Sep 18, 2007 4:05 am 
Beginner
Beginner

Joined: Wed Jul 25, 2007 6:32 am
Posts: 22
Today I noticed that the items mapped in Category.hbm.xml are ordered by a DISPLAY_POSITION.


When I look in Item.hbm.xml I see no display position property, so it only resists in the database table. But how is this DISPLAY_POSITION being updated?

When I add a new Item is this DISPLAY_POSITION Column then auto incremented?

Is there also a possiblity to use the startDate as the index?
Like this:

<list name="items" table="CATEGORY_ITEM">
<key column="CATEGORY_ID" />
<list-index column="START_DATE"/>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 18, 2007 10:02 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Quote:
But how is this DISPLAY_POSITION being updated?


It's the index of a java.util.List.

Quote:
When I add a new Item is this DISPLAY_POSITION Column then auto incremented?


Well, yes.

Quote:
Is there also a possiblity to use the startDate as the index?


java.util.List has a numeric index, what you are looking for is called java.util.Map.

_________________
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.