-->
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: Mapping help
PostPosted: Mon Sep 18, 2006 5:41 am 
Regular
Regular

Joined: Thu May 11, 2006 12:30 pm
Posts: 72
i cannot map these 2 tables (* indicate primary key)

TABLE COMTB00F (Cities, Parent)
CMKEY*
CMDTDA*
CMDESC
CMPRV
CMCAP

TABLE CAPTB00F (Child)
CAPCCOM*
CAPKEY*
CAPINAIL

the relation should be between CMKEY and CAPCCOM; i need to load for each CMKEY|CMDTDA record, a list of possible CAP records

with the following mapping files i get an error because the foreign key differs from parent key

Hibernate version: 1.2.0 alpha 1

Mapping documents:

TABLE COMTB00F (Cities, Parent)
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'>
<class name='CUP.Cities, CUP' table='COMTB00F'>
<composite-id>
<key-property name='ID' column='CMKEY' />
<key-property name='StartValidity' column='CMDTDA' />
</composite-id>
<property name='Description' column='CMDESC' />
<property name='State' column='CMPRV' />
<property name='Postal' column='CMCAP' />
<bag name='CAPs' table ='CAPTB00F'>
<key>
<column name ='CAPCCOM'/>
</key>
<one-to-many class ='CUP.CAP, CUP'/>
</bag>
</class>
</hibernate-mapping>

TABLE CAPTB00F (Child)
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'>
<class name='CUP.CAP, CUP' table='CAPTB00F'>
<composite-id>
<key-property name='CityID' column='CAPCCOM' />
<key-property name='ID' column='CAPKEY' />
</composite-id>
<property name='INAIL' column='CAPINAIL' />
</class>
</hibernate-mapping>
Name and version of the database you are using: Oracle 10g


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.