Well, Hello there! I'm diving into JPA, and I decided It'd be the right decision to start my training by reading the
JEE 5 Tutorial. I'm kinda stuck in one of the key concepts here... Let me explain..
From the JEE 5 Tutorial
Composite primary keys must be defined in a
primary key class
From that statement I understood one must write a class(restrictions applied) in which all the fields are the
Composite Key itself, am I right?
Now, among the requirements of a
primary key class; I don't understand the following one(s):
[Taken from the
Java EE 5 Tutorial]
A composite primary key must be represented and mapped to multiple fields or properties of the entity class, or must be represented and mapped as an embeddable class.
And...
If the class is mapped to multiple fields or properties of the entity class, the names and types of the primary key fields or properties in the primary key class must match those of the entity class.
Could someone please explain to me how these last requirements are applied to the actual Entity class? I don't understand How does one as a programmer map the composite KEY to Multiple Fields or Properties in a given Entity class.
Thanks in advance for all the support!
Best Regards!
Jose.