Use a join table.
An example from our code using annotations is that at the class level we declare:
Code:
@SecondaryTables({@SecondaryTable(name = "WE_PROPERTY_PERIOD", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "WE_PROPERTY_PERIOD_ID", referencedColumnName = "WORKFLOW_EVENT_ID")})})
which sets up the table and tells hibernate what column you're joining on.
And then for the property in question:
Code:
@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "LOCATION_PROPERTY_ID", unique = false, nullable = false, insertable = true, updatable = false, table = "WE_PROPERTY_PERIOD")
which denotes the table and column that the property maps to.