I have parent/child relationship between two tables, and the corresponding mapping in my Java classes. The tables roughly look like that:
A (ref number, stuf
If I am understanding the question right, there is a way to do this with javax.persistence annotations (I used this on a ManyToOne myself, and tailored the answer from here):
@JoinColumns({
@JoinColumn(name = "A_REF", referencedColumnName = "REF"),
@JoinColumn(name = "B_TABLE_NAME.OTHER", referencedColumnName = "'123'")})
@OneToMany
private Set bs;
Note the single quotes in the referencedColumnName, this is the value you are looking for.
More information here.