targetEntity : Used to specify the class of the target entity.
Must be specified if class is not specified in generic.
For example,
It must be specified for field:
Set children;
It should not be specified for field:
Set<Child> children;
mappedBy : Denotes the "field" in the "other" table whose primary-key is present as foreign-key in the "other" table.
Example:
The mappedBy property will not work if there is no matching annotation on the entity on the other side.
In the above case, the foreign key must be present as
@ManyToOne annotation on the field "customer" in the entity "Order".