Hibernate – Foreign keys instead of Entities

Yes, you can do that. You just need to make it clear for hibernate which one is the mapping that it’s supposed to maintain, like so:

@Column(name="message_key", updatable=false, insertable=false)
private Long message_fk;

Leave a Comment