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)
|