Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPA - Nullable column as part of IdClass

843833Feb 19 2008
I have a table which I'm trying to map w/ JPA. Unfortunately the primary key of this table is a combination of 6 columns, all of which are nullable according to the ddl. In practice, only one of these columns is ever actual nulled.

The problem seems to occur on rows where this column has a null value. In those instances, a standard jpa query will return a null object instead of an object with that column nulled. Also, since this column helps identify the uniqueness of a row, I can't remove it from the primary key. Doing so results in multiple instances of the same object being returned.

I have set this up w/ an @IdClass tag on the main class, 6 @Id annotations in the main class, and an @embeddable class w/ 6 properties (which match the 6 @Id annotations).

Any advice is appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2008
Added on Feb 19 2008
0 comments
565 views