-->
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: <list> index offset attribute?
PostPosted: Sun Oct 23, 2005 5:22 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 1:00 pm
Posts: 29
I'm loading an indexed list, however the indexed numbers start at 1 and count up (not zero). When I try to iterate over the loaded list using foreach, the first element comes back null. I could explicitly check for null, but I'm not sure how much code actually iterates over this list, and I'd have to change it all. I was wondering if there was some sort of "offset" parameter for the <index> field of the NHibernate mapping file. Something like:
Code:
    <list name="appliances" cascade="all" lazy="true">
      <key column="ProductId" />
      <index column="position" offset="1" />
      <one-to-many class="SpringAir.Objects.Appliance, SpringAir.Objects" />
    </list>

So NHibernate would subtract the offset before using it as an index when loading it into the list. I hope I'm explaining this well...

I just realized I may also have another problem. The list of loaded objects may have overlapping indices in some cases, because there are two rows of appliances; they are differentiated in the list by another identifier (bool or int to indicate which row it's in). Will this be a problem?

I see in the documentation that there are undocumented <index-many-to-many>, <composite-index> and <index-many-to-any> possibilities. Anything of help there?


Top
 Profile  
 
 Post subject: Bump this
PostPosted: Tue Apr 18, 2006 7:55 pm 
Newbie

Joined: Tue Apr 18, 2006 7:53 pm
Posts: 1
I have need of an offset attribute as well. If anyone knows how to do this with Hibernate 2.0 please post a reply. Thanks in advance.


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.