Hi,
Code:
MyChild.class
....
@ManyToOne
@JoinColumns({
@JoinColumn(name="p_code",referencedColumnName="p_id",insertable=false,updatable=false),
@JoinColumn(name="block_nr",referencedColumnName="block_nr",insertable=false,updatable=false)
})
private MyEntity fparam;
My MyEntity has embeddable pk with two fields but my Child entity only has one of them (p_id). I would like to set up the relationship described above but I'd like to provide a value for block_nr and not the column.
At the end my query would look like this.
select * from myentity where p_id=:p_code and block_nr=1;
I just want to query the description belongs to the p_code nothing more.
I could achieve this via namedquery but usually I love to choose the harder way :).
Is it possible in this way or should I forget it ?
TIA
Regards, Sandor