-->
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.  [ 5 posts ] 
Author Message
 Post subject: What is the meaning of index?
PostPosted: Wed Feb 25, 2004 6:26 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Sample:
Code:
<list name="carComponents" table="car_components">
    <key column="car_id"/>
    <index column="posn"/>
    <composite-element class="com.illflow.CarComponent">
            <property name="price" type="float"/>
            <property name="type" type="com.illflow.ComponentType"/>
            <property name="serialNumber" column="serial_no" type="string"/>
    </composite-element>
</list>

"car_id" is the foreign key column name. "posn" is which column name? I don't understand it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 7:43 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
the collection will be ordered by posn


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 8:56 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
delpouve wrote:
the collection will be ordered by posn

Even more, the collection will be indexed by posn

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 11:30 pm 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
e.g.
Code:
Parent table:
id, name
Child table:
id, parent_id, child_name

parent_id is <key column="parent_id"/>
which column is "posn"?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 26, 2004 12:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I would guess none, but you know your schema better than me.

Seriously, I think you just did not fully read the documentation regarding hibernate collections, specifically the list mapping. In the java2 collection farmework, the java.util.List interface defines a contract for a ollection in which all the elements of that collection are positionally indexed. In other word, in a List impl order does matter. Hibernate takes this to heart and thus you must specify how the elements are to be ordered.

In short it is mostly likely not a <list> mapping you want, but rather a <set> or <bag>. Please read the docs regarding mapping of collections.


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