-->
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: Addition Columns in Table when definig 1:N Assiciations
PostPosted: Wed Sep 14, 2005 10:01 am 
Beginner
Beginner

Joined: Mon Sep 12, 2005 3:27 am
Posts: 48
Hello, sorry for the next question - but what is the normal way to handle associations between to tables (per example between "customer" and "order").

If the customer-entity (table) has an primary key aka long-value, have i to declare an foreign key-property in the order-entity as equivalent long-value and declare the mapping with @OneToMany constraint on these two long-propertys (or their getters) ?

Or have I to go a more object-orientated way and declare simply an custormer-entity (aka Component "customer") in the order-Entity, then mark Customer.class as @Embedable and try hibernate to create the Association between these two Entitys (tables) ?


I ask, because hibernate tries to create an addition column in the N-Table of a 1:N association or even a Join-table (by a simple 1:N assiontion !).

Is ist the normal way:

- to let Hibernate create the (additional) association columns on the n-side or
- include assiocated entities (tables) as @embedded component in the other-Entity or
- or to manually generate foreign-key property's in the n-side Entity and the control the mapping via @OneToMany (mappedBy= "column on the n-side)


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.