EmbeddedId « Map « JPA Q&A





1. hibernate mapping where embeddedid    stackoverflow.com

hello I have Entitys and EntityAddress where every entity can have lots of addresses like that:

Table(name ="ENTITY")
public class Entitys extends TrackableEntity{ 

//lotsOfData...

@OneToMany(mappedBy="entity",fetch = FetchType.EAGER )
private List<EntityAddress> entityAddressList;
public List<EntityAddress> getEntityAddressList() {
   ...

2. OneToOne mapping with embeddedId    forum.hibernate.org

@EmbeddedId @AttributeOverrides( { @AttributeOverride(name = "triggerName", column = @Column(name = "trigger_name", nullable = false, length = 200)), @AttributeOverride(name = "triggerGroup", column = @Column(name = "trigger_group", nullable = false, length = 200)) }) public QrtzTriggersId getId() { ...

3. EmbeddedId, Inheritance and SecondaryTable    forum.hibernate.org

@Entity @DiscriminatorValue("VALUE") @org.hibernate.annotations.Entity(mutable = false) @SecondaryTable(name = "V_SECONDARY_TABLE", pkJoinColumns = @PrimaryKeyJoinColumn(name = "ID", referencedColumnName = "ID")) public class SubClass extends SuperClass { @Embedded public Field getField() { return getField; } }

4. ManyToOne from inside EmbeddedId - code attached    forum.hibernate.org

Newbie Joined: Sun Aug 30, 2009 11:04 am Posts: 4 Hey folks, I have three classes (in a ticket system) Ticket.java, Recipient.java, RecipientPK.java RecipientPK is the embeddedId in Recipient, and the point is that every Ticket can have many Recipients. RecipientPK.java Code: @SuppressWarnings("serial") @org.hibernate.annotations.AccessType("property") @Embeddable public class RecipientPK implements Serializable { private long ticketId; private ...