-->
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.  [ 1 post ] 
Author Message
 Post subject: String array mapping-id field (i.e primary key) definition
PostPosted: Tue Sep 23, 2008 5:25 pm 
Newbie

Joined: Tue Sep 23, 2008 4:44 pm
Posts: 15
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) );


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.