1) If I map an array type field to a separate table ( not the parent table), is there a way to define the primary key field (i.e "id" field) of the child table? The <array> element does not allow an <id> nested element.
2) Is the use of <element> the correct way to map the value of the array type field?
Note that I don't want to use components because i am using table per inheritance hierarchy and only one type in the hierarchy has a range field.
// class definition
Code:
public class Person{
String id;
String name;
String[] range;
}
// mapping:
Code:
<class ...>
<subclass name="Person" table="PERSON>
<id name="id" column="PERSON_ID/>
<property name="name" column="PERSON_NAME/>
<array name="range" table="RANGE_VALUES" cascade="all">
<key column="person_id" />
<list-index column="range_index" />
<element column="RANGE_VALUE" type="string">
</element>
[b] <!-- Shouldn't there be an "<id>" element definition here that defines primary key-"RANGE_ID" for the RANGE_VALUES TABLE? --> [/b]
</array>
// sql DDL
Code:
create table RANGE_VALUES (RANGE_ID Number(5), RANGE_INDEX Number(*,0), PERSON_ID VARCHAR2(20) foreign key..., RANGE_VALUE VARCHAR2(10) );