[hibernate-dev] Embedded Composite Identifiers

Steve Ebersole steve at hibernate.org
Mon Aug 3 11:30:59 EDT 2015


I am thinking we should start to soft-deprecate[1] the historical feature
of embedded composite identifiers.  This is the feature that allowed an
entity to define a composite identifier without any kind of "pk class"
(EmbeddedId/IdClass):

@Entity
public class MyEntity {
    @Id
    public Integer key1;
    @Id
    public Integer key2;
   ...
}

The you'd always have to instantiate the entity to deal with its
identifier.  For example, to load such an entity:

MyEntity id = new MyEntity(1,2);
MyEntity it = session.get( MyEntity.class, id );

 Between EmbeddedId and IdClass there are better alternatives to document.

Thoughts?

[1] - By "soft-deprecate" I mean remove discussion of it from the
documentation, and don't really push it.


More information about the hibernate-dev mailing list