PK « Key « JPA Q&A

1. many-to-many the same PK

How should I do if I have two tables and their primary keys have the same name like the following XML mapping file suggests?

<class name="Person" table="person">

    <id name="uid_" ...

2. JPA: Is there a way to return the next availble PK

if the field id inside my Entity is like this

@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
then when I persist the Entity, a unique random Id is created. Is there a way that I ...

3. Hibernate supports for PK

I am working on a Hibernate Project and some of my database tables does not have Primary Key. I looked into Hibernate reference and could found how to handle a table which does not have PK on it. So, I am wondering if Hibernate supports table mapping without PK ??? Has anyone come across this situation ???

4. PK in tables

Hi! I know that this could be a little boring to You ;) but is possible to use Hibernate on tables without PK? Tables was designed without it and now I have a problem with this. The biggest table have 56 fields (not my design ;) so hand-made objects are dificult to create. I've tried to do so but HB descriptor ...

5. Best practices for legacy data with no PK

I'm very new to Hibernate, and I've run into an issue dealing with legacy data (in this case DB2/400 running Mapics manufacturing software). I have a table which has no native primary key, and I am unable to build a unique composite key since in a few cases entire rows are duplicated. I'm using , and I understand implementing my own ...

6. PK question

email: i am trying to do some testing with sequence identifier generators, so i was going to use HSQLDB, since it now supports sequences (and since oracle on my laptop eats up 300M of my memory just by cranking it up). so i notice that the hsqldb dialect does not support sequences. so my question is can you give me a ...

7. Timing issue when hibernates creates the PK

Hibernate version:2.1.7c I have an application which useses DTOs to carry data from one layer to the other. This is the problem I encounter: My DTO arrives in the business layer. The DTO contains data to an existing parent and information on a new child: 1. I start a transaction 2 I use the information in the DTO to retrieve the ...

8. Change PK in tables

9. Proxied one-to-one on PK doesn't initialize

I've got a unidirectional one-to-one relationship on a primary key, configured as per the documentation. In other words, for every instance of object A there exists an object B with a primary key identical to that of the A instance. Instances of object B hold references to their corresponding instances of object A, but not the other way around. I have ...

10. JoinTable with wrong PK

hi, I have following annotations in my code: Code: @Entity @Table(name = "TOURPOSITION") public class TourPosition implements Serializable { ...... @ManyToOne @JoinTable(name = "TPOS_TOURKOPF_TKO", joinColumns = @JoinColumn(name = "TPOS_UID") , inverseJoinColumns = @JoinColumn(name ...

11. Problem with mutiple comlumns PK

@Id @Column(name="TIME") public Timestamp getTime() {return time;} public void setTime(Timestamp time) {this.time = time;} @Id @Column(name="PAPERID") public String getPaperId() {return paperId;} public void setPaperId(String paperId) {this.paperId = paperId;}

12. auto-incremented PK