embed « Composite « JPA Q&A





1. Does Hibernate disallow read-only on @Column in embedded ID composite primary key classes (bug?)?    stackoverflow.com

Here's the DB design (DDL):

CREATE TABLE Countries
(
  iso_code CHAR(2) NOT NULL,
  name VARCHAR(50) NOT NULL,
  PRIMARY KEY (iso_code)
);

CREATE TABLE Zips
(
  country_code CHAR(2) NOT NULL,
  code VARCHAR(10) ...

2. How to write JPQL SELECT with embedded id?    stackoverflow.com

I'm using Toplink essentials (JPA) + GlassFish v3 + NetBean 6.9 I have one table with composite primary key:

table (machine)
----------------
|PK machineId  |
|PK workId     |
|    ...

3. Hibernate: read-only on @Column in embedded ID composite key classes mapping exception - bug?    coderanch.com

@Entity @Table(name = "Zips") public class Zip implements Serializable { @EmbeddedId private ZipId embeddedId; @ManyToOne @JoinColumn(name = "country_code", referencedColumnName = "iso_code") private Country country = null; ... } @Embeddable public class ZipId implements Serializable { @Column(name = "country_code", insertable = false, updatable = false) private String countryCode; @Column(name = "code") private String code; ... }

4. NPE when persisting entity with embedded composite key    forum.hibernate.org

Author Message nickpdx Post subject: NPE when persisting entity with embedded composite key Posted: Thu Feb 11, 2010 12:54 am Newbie Joined: Wed Feb 10, 2010 11:50 pm Posts: 2 I'm going off the writeup on many-to-many associations with composite key at http://boris.kirzner.info/blog/archives ... osite-key/ . My particular legacy domain crap has a join entity with 3, not 2, ...

5. Is it possible to embed a subclass into a composite-element    forum.hibernate.org

Hi guys, I would like to know if there is a possiblity to embed a sublass element into the composite element of the set/bag/idbag element ? Imagine I have two classes that extend one abstract class that is mapped to an unique table. (table per class hierarchy mapping). These classes could be composite-elements in a idbag element of a parent Entity. ...

6.  with embedded foreign key    forum.hibernate.org

I have run into an issue when deleting a collection of persistent objects, modeled as a "many-to-one" relationship, in which the "many" objects are mapped with a that contains a foreign key to the "one" object. When using the OO-like approach where you treat persistent objects as you would POJOs, it seems to result in two behaviours that are undesirable ...

7. Embedded Error with composite-id    forum.hibernate.org

Newbie Joined: Tue May 05, 2009 3:11 am Posts: 3 Hi, I have a problem with the creation of composite primary keys with forgein keys. An exception is thrown when executing an ant-taks with maven and hbm2ddl. It mentions that the class of the composite id is not found, but I thought this class will be created by excuting hbm2ddl or ...