| 
					
						 Hibernate version: 
 3.0.1
 
 Mapping documents:
 	<class name="Child"
 		table="CHILD">
 		<composite-id name="key"
 			class="ChildPK">
 			<key-property name="key1" column="KEY1"
 				type="java.lang.Long" length="19">
 			</key-property>
 			<key-property name="key2" column="KEY2"
 				type="java.lang.Long" length="19">
 			</key-property>
 		</composite-id>
 	    <!-- bi-directional many-to-one association to Parent -->
 	    <many-to-one
 	        name="parent"
 	        class="Parent"
 	        not-null="true"
 	        column="parent_id"
 	    />
 	</class>
 	<class name="Parent"
 		table="PARENT">
         <id name="id" column="id">
             <generator class="native"/>
         </id>
 		<property name="name" type="java.lang.String"
 			column="NAME" length="250">
 		</property>
 	    <!-- bi-directional one-to-many association to Childl -->
 	    <list name="children">
 	        <key column="parent_id"/>
 	        <list-index column="key2" base="1"/>
 	        <one-to-many class="Child"/>
 	    </list>
 	</class>
 
  DDL generated by exportddl
 create table PARENT (
    id bigint generated by default as identity (start with 1),
    NAME varchar(250),
    primary key (id)
 );
 create table CHILD (
    KEY1 bigint not null,
    KEY2 bigint not null,
    parent_id bigint not null,
    key2 integer,
    primary key (KEY1, KEY2)
 );
 
 Note
 See that exportddl has generated two "key2" columns in the child table, one from the composite-id (KEY2), and one from the list-index in the Parent mapping (key2).
 
 When I change the case of the list-index column, the "duplicate" column goes away.
 
 Is this a bug or a feature (maybe for case-sensitive databases?).
 
 John Latham 
					
  
						
					 |