PK « Map « JPA Q&A





1. Mapping Linking Table with 3 PK's in Hibernate    stackoverflow.com

right now I'm having trouble mapping a linking table with Hibernate. First of all I want to explain what I want to map: I have 3 tables: Product , DocumentType, Language. One Product ...

2. Hibernate Cascade: De-reference parent PK in child table without removing child object    stackoverflow.com

If a parent object starts off with a list of 3 children objects, removes child 1 and calls session.update(parent), what kind of hibernate mapping would I need in order to clear ...

3. Persist PK Object with JPA (ManyToMany)    stackoverflow.com

Please change title if you know a better one, because I really don't know how to express the problem. I've got three classes:

@Entity
public class User {

 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 @Column(name = ...

4. hibernate - mapping PK to 2 colums    stackoverflow.com

i search the web for answer, but all the answers refer to composite id PK. i want two map two columns of type long to PK. one should be regular generated id, and ...

5. Hibernate Annotation - ManyToMany within same PK on an external table    coderanch.com

Hello, This is my first post here. I am facing an issue with an annotation mapping with hibernate. The thing is than I need to manage which messages where sent from an Account to other Account, and the actual state than this message is in(Read, Unread, etc). Table diagram is this This is the code than I have for now. @Entity ...

6. One-to-many mapping with no PK's?    forum.hibernate.org

Normally one-to-many mappings in Hibernate are done through a FK column on one table referencing a PK column on another table. My dilemma is, the table that the FK column would normally be pointing to has been replaced with a view that doesn't really have any PK's (though that former PK column is still there). How do I declare that one-to-many ...

7. Child table linked to a parent table column which is not PK    forum.hibernate.org

Hello, I'm quite sure the solution to that is really simple but i can't find which one to use in the documentation. I'm using JPA annotations and hibernate 3.5 Here is the situation: 2 tables: product_version and product_issue, both tables have a "version" column (which is a String/VARCHAR). in table product_version, multiple records can exist with the same version but in ...

8. Mapping Table with 3 ManyToOne assosiated pk fields    forum.hibernate.org

Hi, I am new to Hibernate & JPA and I decided to use Hibernate instead of Ibatis at may new project. But now a little worried about deadline. I am reading hibernate jpa docs and it was awesome for simple mappings. But now get stuck with mapping TableC with 3 ManyToOne assosiated pk fields. TableA + aId (pk) TableB + bId ...

9. ManyToMany by column that is not PK    forum.hibernate.org





10. many-to-one mapping with non pk    forum.hibernate.org

hi, I have a lookup table with the following structure: CREATE TABLE payroll_title ( payroll_title_id int(11) NOT NULL auto_increment, code varchar(4) NOT NULL, name varchar(30) NOT NULL, PRIMARY KEY (payroll_title_id) ); and a corresponding mapping file: ...

12. Map without Pk ...    forum.hibernate.org

13. How to map a Map's index to something else than PK    forum.hibernate.org

Hi, I've got probably a simple problem to solve, but I've been rtfm and looking for a solution, but I admit I already have a problem to express my problem in plain english... So here it goes: I've got 2 tables : countries and countries_i18n that, among others, have these columns: Country: - id: PK - iso: char[2]: [A-Z]{2} UNIQUE Country_I18N ...

14. Map table without pk    forum.hibernate.org

Hi, I'm sorry for my English, but I can't speak English very well. I must map a particular table: there isn't a pk! It is a log table! I've try to map the table but is required! How can I map this table? Or must I alter the table? Must I add a Pk? Thanks everybody :-) Mary

15. ManyToOne in PK    forum.hibernate.org

16. How to do OneToOne mapping in PK class    forum.hibernate.org

How do I do a OneToOne mapping to class from the Embedded class of another. Hibernate version:3.2.0.GA Mapping documents: @Entity @Table(name = "VEHICLE_PAYMENT_VEHICLE") public class VehiclePaymentVehicle implements java.io.Serializable { @EmbeddedId private VehiclePaymentVehiclePK vehiclePaymentVehiclePK; ... @Embeddable public class VehiclePaymentVehiclePK implements java.io.Serializable { // @Column(name = "CAR_ID", nullable=false, updatable=false) // private Long carId; @OneToOne(mappedBy="carId") @JoinColumn(name="CAR_ID", referencedColumnName="CAR_ID") private Car car; @Entity @Table(name = "CAR") ...





17. Mapping to property that is neither pk nor unique    forum.hibernate.org

I have got 2 tables jobs and person, which I need to map. jobs ----------- jobId (pk) lastUpdateUser person --------------- id (pk) mailId flag1 flag2 flag3 Now i need to map lastUpdateUser in jobs to mailId in person, and the problem is neither of them is unique. ...

18. Do I have to map a PK?    forum.hibernate.org

Hi all, My question is as subject. The reason being that the application I'm working on use a legacy DB, and the domain object created only need a few fields from the underlaying table, therefore, some of the PK columns are not presented in the domain object, not sure how to deal with this case. And also when querying the object ...

20. Problems with Many to Many Mapping over a non PK Column    forum.hibernate.org

Hi, I'm having some issues with a Many To Many Mapping. I have two Tables (TABLE1, TABLE2) each having a Primary Key named ID and another Column named NUMBER. Additionally I have a Join Table (TABLE1_TABLE2) with two columns NUMBER1 and NUMBER2. What I want is a Many To Many Join using the NUMBER columns and not the ID columns. I ...

21. 3 pk fields mapping table    forum.hibernate.org