-->
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.  [ 4 posts ] 
Author Message
 Post subject: relation tables, foreignkeys, and composite ids
PostPosted: Fri Jul 23, 2004 3:59 am 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
I was trying to do something I thought would be straight forward.. but after a couple of hours of trying, and browsing the forums.. I have nothing.

I am trying to create a relation table.

Basically:


<composite-id name="comp_id" class="InvoiceExportItemPK">
<key-many-to-one name="invoice" class="Invoice" column="INVOICE_ID"/>
<key-many-to-one name="invoiceExport" class="InvoiceExport" column="INVOICE_EXPORT_ID"/>
</composite-id>

Where:
InvoiceExportDetail {
INTEGER Invoice_ID (FK) PK1
INTEGER InvoiceExport_ID (FK) PK2
VARCHAR Notes
}

INVOICE {
INTEGER INVOICE_ID (PK)
...
}

INVOICE_EXPORT {
INTEGER INVOICE_EXPORT_ID (PK)
...
}

I have tried a number of variations with no luck.. and would appreciate any insight.

Thanks



-- ERROR:


net.sf.hibernate.MappingException: invalid join columns for association: invoiceExportDetail


Top
 Profile  
 
 Post subject: Solution
PostPosted: Fri Jul 23, 2004 4:12 am 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
So.. the problem was my one-to-one relation in the Invoice mapping.

After rereading (a dozen times) the post at: http://forum.hibernate.org/viewtopic.ph ... ssociation

I finally figured it out.

I will just give the following a try:


<many-to-one name="invoice"
class="Invoice"
insert="false"
update="false"
constrained="true">
<column name="invoice_id"/>
<column name="invoice_item_id"/>
</many-to-one>

Note: Some of my initial problem appears to be an issue with Middlegen. The <composite-id> tag had nested META tags and it was blowing up as well.

Cheers


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 23, 2004 4:15 am 
Newbie

Joined: Tue Jul 06, 2004 4:30 pm
Posts: 6
If you are interested,
we've implemented such a case this week with "composite element",
just let me know if you want example mapping/value objects files.


Top
 Profile  
 
 Post subject: Examples would be great
PostPosted: Fri Jul 23, 2004 12:13 pm 
Regular
Regular

Joined: Mon Nov 03, 2003 6:10 am
Posts: 75
Examples would be helpful and greatly appreciated.

Thanks

Troy

tlacourt wrote:
If you are interested,
we've implemented such a case this week with "composite element",
just let me know if you want example mapping/value objects files.


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