Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JPA OUTER JOIN without relation

Tags:

outer-join

jpa

I need make OUTER JOIN of two entities in JPA (saying master, detail), but the problem that at the entity level there are no relations (and I don't want add it).

@Entity
class Master
{
    @Column(name="altKey")
    Integer altKey;
}

@Entity
class Detail
{
    @Column(name="altKeyRef")
    @Basic (optional = true)
    Integer altKeyRef;
}
SELECT m, d FROM Master m OUTER JOIN ????? d.altKeyRef = m.altKey
like image 803
Dewfy Avatar asked Mar 29 '26 03:03

Dewfy


1 Answers

My understanding of the spec (see 4.14 BNF) is that a [ LEFT [OUTER] | INNER ] JOIN mush be done along a path expression (either a single valued association field or a collection valued association field).

like image 200
Pascal Thivent Avatar answered Apr 02 '26 02:04

Pascal Thivent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!