Hello OpenJPA users,

if have the following OpenJPA query. It gets all company-ids and for the companies having a lastmodifiedby-user, it should return the username:

select c.id, c.lastModifiedBy.username from Company c

The resulting native query is:

SELECT t0.id, t1.username FROM Company t0 INNER JOIN dbuser t1 ON t0.lastModifiedBy_id = t1.id

This one does an inner join on the dbuser table, but i need to fetch the records by a left join. In my opinion, the left join should be default on relation traversial operations, because then you could easiely have the other behavoiur with a simple "WHERE c.lastModifiedBy IS NOT NULL". With the current behaviour i have to do UNION-SELECTs if i just want to have every field. Is there a way to change this behaviour?

Greetings,
Daniel Migowski

Reply via email to