hi all!
i have a problem with the following setup. i have two entities mapped to exactly two tables in oracle. i would like to generate list with dynamic filtering, so i have an ejbql fragment (select prop1, prop2.prop1, prop3 from entity1) creating the where condition at runtime. i have problem with the sql hibernate generates from this code. the problem is:
entity1 has a foreign key to entity2 which can be null (is optional). but hibernate creates a cross join and a where stating entity1.fk = entity2.id.
entity1.fk has annotations:
@ManyToOne(fetch=FetchType.LAZY, optional=true, targetEntity=Entity2.class)
@JoinColumn(name="fk_id")
how can i make hibernate do a left join instead of this cross join?
|