Here is what I proposes in the documentation in the section discussing
composite identifiers:
<note>
<para>
Technically a composite identifier can be made up of just a
single persistent attribute.
</para>
<para>
The restriction that a composite identifier has to be
represented by a "primary key class" is
a JPA restriction. Hibernate does allow composite identifiers
to be defined without a
"primary key class", but use of that modeling technique is
deprecated and not discussed here.
</para>
</note>
On Mon, Aug 3, 2015 at 10:30 AM Steve Ebersole <steve(a)hibernate.org> wrote:
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.