I wonder how JPA defines to handle following scenario:
Table A: | Table B:
ID FK_B | ID
1 10 | 10
2 null | 12
3 11 |
I want all Table A entries with FK_B NULL or referencing not available Table B entry.
public class A implements Serializable {
@Id
private Long id;
@JoinColumn(name = "FK_B", nullable = true)
@ManyToOne
private B b;
}
public class B implements Serializable {
@Id
private Long id;
}
Is it defined, what happens if I use
SELECT a FROM A a LEFT JOIN a.b WHERE a.b IS NULL
or: (Is this possible?)
SELECT a FROM A a LEFT JOIN B b on (b = a.b) WHERE b IS NULL
What I need is a list containing
A(id = 2)
A(id = 3)
Thanks a lot!