PK « Composite « JPA Q&A





1. Hibernate Mapping - foreign key referencing a composite PK    stackoverflow.com

I need some help in defining the Hibernate annotation for a foreign key referencing a composite PK table. My composite PK table is FqTankType and I have defined it as

private FqTankTypeId  ...

2. Hibernate Mapping- composite id (pk+ foreign key)    coderanch.com

hi, In one of my tables, the composite key is consist of one auto increment key and one foreign key; this composite key is used as foreign key in some tables. In the hibernate mapping, doesnt allow , so i enabled the auto increment property for ID filed at data base level. Because of this scenario, the records are getting ...

3. When will you encourage using composite PK's?    forum.hibernate.org

I've been dealing with composite id's and asked a few questions and I was recommended to replace my composite PK's with a single id column, and to control integrity with indexes... All of this related to the fact that mapping composite id's isn't that simple... On the other side, some people encourage the usage of composite id's that are accord to ...

4. Don't want PK to include composite-element extra columns    forum.hibernate.org

What if I don't want the primary key of the many-to-many association table created by the composite-element with many-to-one technique to include the extra columns? I only want the two foreign keys to make up the composite primary key, and not the extra column information. I actually have a use-case for this, as I am mapping to a legacy database. Take ...

5. Can Hibernate update a persisted object's composite PK?    forum.hibernate.org

Hibernate version: 2.1.6 Name and version of the database you are using: MSSQL 2000 My first question: can hibernate update a persisted object's composite primary key? i.e., I initially insert into the database my object, X, which has a composite PK of [model: ford, year: 2000]. I later decide it should [model: ford, year: 2001]. Can hibernate take care of this ...

6. Many-to-Many annotations. Composite PK Table name concat    forum.hibernate.org

@OneToMany ( targetEntity = Table2VO.class, cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY ) @JoinTable(table=@Table(name="Table1_Table2")) @JoinColumns ({ @JoinColumn(name="col1", referencedColumnName = "col1"), @JoinColumn(name="col2", referencedColumnName = "col2"), ...

7. Basic Use Case: Parent Child + composite PK + Dynamic Sess    forum.hibernate.org

Hibernate version: 3.1.2 I am having some 'fun' with what I think is a very basic use case, which has been discussed ad nauseum before, for example here: http://forum.hibernate.org/viewtopic.ph ... ber+childs Actually I am reusing the example from that thread as much as possible. My Relational model depends on composite keys for child tables, where the first part of the primary ...

8. Auditing for Composite PK    forum.hibernate.org

Newbie Joined: Mon Oct 09, 2006 11:50 pm Posts: 2 Can anyone help me to audit a table which has composite primary key ? In my logchanges () method, I am persisting the EntityId to the AuditLog table, Incase if the table has a single Primary key, the Entity Id will be filled with proper values. For me the requirement is ...

9.  PK mapping to a     forum.hibernate.org

Hello, I've scoured the net for an answer but I haven't been able to find one, I guess I must a newb but here it goes. I will try to be as clear as possible. I have a class A which has a composite key identifier: Its impl would look like: Code: public class A { public final static ...





10. Composite PK that double as foreign    forum.hibernate.org

Beginner Joined: Thu Aug 17, 2006 12:44 pm Posts: 22 Location: Ohio The location table has a PK made up of 3 FK fields. The only way that I can successfully add a row to the location table is if I save the customer, email, and phone records first, build the LocationId myself, associate it to the location class and then ...

11. Issue with persisting child objects: Child has composite PK    forum.hibernate.org

I am working on an application that uses EJB3 and JPA + Seam. In one of the screens in the application, I am creating new instances of a Parent object at run-time and also, creating new instances of Child objects. Following are the definitions (and mappings) of the two classes: @Entity public class Parent { @OneToMany(fetch=FetchType.LAZY, mappedBy="parent", cascade={CascadeType.ALL} private List children; ...