Currently, Hibernate allows me to load objects defined by *-to-one relationships directly with
Is it possible to get the foreign key instead of the object?
The current approach which I see is having addint to my mapping:
@JoinColumn(name="message_key") @ManyToOne(targetEntity=Message.class,fetch=FetchType.LAZY) private Message message; //these lines currently exist @Column(name="message_key") private Long message_fk; //the idea is to add those 2 lines
Is there a better approach to get the foreign key, or is this the only one?