-->
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 mapping has null entry at the beginning every time
PostPosted: Fri Jun 25, 2004 11:08 am 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
I'm having a problem where a list mapping produces a null object at the beginning of the list. Here is the mapping:

Code:
   <class name="com.upfactor.rns.domain.security.Page" table="page">
      <id name="id" column="id" type="long" unsaved-value="0">
         <generator class="sequence">
            <param name="sequence">page_id_seq</param>
         </generator>
      </id>
      <many-to-one name="parent" column="parent_id" class="com.upfactor.rns.domain.security.Page"/>
      <property name="name" column="name"/>
      <property name="url" column="url"/>
      <property name="isSecure" column="is_secure"/>
      <property name="orderIndex" column="order_index"/>
      <list name="children" table="page" inverse="true" lazy="true">
         <key column="parent_id"/>
         <index column="order_index" />
         <one-to-many class="com.upfactor.rns.domain.security.Page"/>
      </list>
   </class>



Does anyone know why Hibernate would do this? I've tried to narrow the search down with the where attribute (like making sure parent_id is not null), but to no effect. order_index follows an application constraint where a page's children cannot share the same index (this is tested and it works). So, if the page had 3 children, they would have unique order_indexs (1,2 and 3). However, when I get the children, I get a list of 4 objects with the first being null. very strang.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 11:33 am 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
nevermind, I just used a bag and sorted by order-index. I realized what was wrong when I had a order index list of 1 2 and 6. I saw that object 2 was being repeated 4 times. My bad.


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.