Hibernate, get foreign id without loading associated entity
I think you will have have to change your Country
entity like below.Add AccessType
annotation on the Id field.
@Entity
public class Country {
@Id@GeneratedValue@AccessType("property")
private Integer id;
private String name;
Faced similar problem,and followed this article:- Accessor Type Annotation