bidirectional « Composite « JPA Q&A





1. Insert null into composite id in bidirectional one-to-many    forum.hibernate.org

Hi experts, I am new to Hibernate and is using hibernate-3.3.2.GA. I am trying to implement a one to many association where the primary key of the 'one' table is one of the composite keys on the 'many' side. Below is the config files and sample code to add both the parent and child. item (the one side) Code:

2. Bidirectional composite element with xdoclet    forum.hibernate.org

I am using hibernate 2.1.1, Ant 1.6, and xdoclet 1.2. I have been unable to xdoclet generate my hibernate mapping docs correctly for a bidirectional many-to-many relationsip. I have three tables: LEFT, CENTER, and RIGHT The LEFT and RIGHT tables each contain an ID column and the CENTER table contains LEFT_ID and RIGHT_ID columns. My POJOs relationships are setup like: Code: ...

3. Use of bidirectional assosiation with composite key    forum.hibernate.org

Hibernate does not work correctly in case a set references to a class with composite id. It issues not an insert, but update statement for the referenced class. Note: in case of simple PKs hibernate works fine (see alternative sections below). Hibernate version: 2.1.8 / 3.0 rc1 Mapping documents: fmsmgr.SERVER_ID_SEQ ...

4. how to annotate bidirectional one-2-many w/ composite pk    forum.hibernate.org

Simple bidirectional one-to-many, order has N order lines, the pk of order line is a composite (order_id, line_item_id). I can't seem to find a way to annotate this so that it would work. Using the latest versions of hibernate + annotations. BTW, I've also tried mappedBy="id" and mappedBy="id.order" Any help is appreciated, marko Hibernate version: 3.2 Mapping documents: @Entity() @Table(name="ORDERS") class ...

5. Bidirectional mapping of an element in composite primary key    forum.hibernate.org

Hi, I am using hibernate version 3.2.0.CR2 and trying to map classes through Annotations(version 3.2.0.CR1). I have got the following classes and am trying to refer to some other entity through one of the elements in composite primary key. @Entity @Table(name="B_level") @AssociationOverride( name="AEntityPk.B", joinColumns=@JoinColumn(name="B_id", referencedColumnName="id") // one of primary key elements referring to some other entity with column name "B_id" ) ...

6. Bidirectional indexed 1-n relation with composite keys    forum.hibernate.org

@Entity public class Invoice { @Id private InvoiceKey invoiceKey; @OneToMany(cascade=CascadeType.ALL) @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) @org.hibernate.annotations.IndexColumn(name="rowNumber", base=1) @JoinColumns({ @JoinColumn(name="customer", referencedColumnName="customer"), @JoinColumn(name="invoiceNumber", referencedColumnName="invoiceNumber") }) ...