@manyToOne and °outer join"

In a new project I am working on I have found a very strange situation, that is causing a test ti fail.

In entity A there is an member @ManyToOne(optional=true,fetchType=LAZY) with the entity B.

When I run a JPQL “from A” it is translated to SQL as a “cross join” with “where A.idB=B.id”, and consequently it returns less itens that spected. The correct would be a “outer join”.

I will write an small project and put it in the github. But, has any of you seen this happening before?

I saw such problems when i used spring data jpa.
See https://jira.spring.io/browse/DATAJPA-1572
Maybe it’s your case/

1 Like