Annotation « Relationship « JPA Q&A

1. Hibernate annotations and foreign key relationship

I have a domain object annotated like this for hibernate support.

@Table(name = "INPUT")
public class AppInput {

   * Unique id for this request

2. Hibernate Annotations Many To Many Relationship Understanding

I have tried 2 different things with hibernate many to many relationship, but i really couldn't find the exact difference between them. First Scenario :

public class Entity1 implements Serializable {
List<Entity2> entitiy2;
Second Scenario ...

3. Hibernate JPA Annotations 1 to 0..1 relationship

I am trying to setup a 1to0..1 (zero or one) relationship, but am running into issues. Now my assumption is to use the @OneToMany, and not @OneToOne. Basically I want my "child" table ...

4. Newbie problem with One-to-Many relationship with annotation

Hi, I'm having trouble using hibernate with JPA annotations. I'm a newbie so apologies if this is a stupid question. I'm trying to do one-to-many relationship between a Product entity and Version entities. A product has many versions, each of which has one product. Code is shown below. I want a deletion of the product to cascade through to the Version ...

5. Telling entity name in relationships using annotations

Is there a way to tell the entity name of the target entity on a relationship ? I wanted something similar to the property "targetEntity" from the tags @OneToMany, @ManyToOne and others... but I wanted to tell the name of entity since I have the Class mapped for two entities. I know how to do this with hbm.xml files but my ...

6. Many to Many relationship annotations

I am having issues with managing a Many to Many relationship. I have a user_address table which is comprised of the user and address class primary keys. Below is the pertinent information: Hibernate version: 3.2 and Annotations Mapping documents: package com.xxxx.users; import org.hibernate.annotations.Cascade; import javax.persistence.*; import; import java.util.List; import java.util.ArrayList; @Entity @Table(schema = "MCWAGNER", name = "xxxx_USERS") public class xxxxUsersEntity ...