Problems with Left Join with EclipseLink - Java

0

I have a problem with the following query:

SELECT * FROM tipo_calibracao t LEFT OUTER JOIN fator_medio f ON (t.id = f.tipo_calibracao AND f.lote = 42) ORDER BY t.id ASC;

Java:

 public List<TipoCalibracao> searchTypes(Long batchId) {
    Query query = em.createNativeQuery("SELECT * FROM tipo_calibracao t " +
            "LEFT JOIN fator_medio f ON (t.id = f.tipo_calibracao AND f.lote = #batchId) ORDER BY t.id ASC", TipoCalibracao.class);
    query.setParameter("batchId", batchId);
    return query.getResultList();
}

Running it in mysql returns what I expect:

'1', 'MO', NULL, NULL, NULL, NULL
'2', 'P', NULL, NULL, NULL, NULL

This would be the normal_table_calibration table and the nulla_factor_table table, but running the same query in Java returns an old result for the factor_mediate table, even though it is checked by the batch, which would be the most current.

I'm using EclipseLink.

    
asked by anonymous 08.01.2018 / 20:04

0 answers