Criteria Query Expression isNull() not working [message #819050] |
Mon, 12 March 2012 12:33 |
FiruzzZ Mising name Messages: 19 Registered: October 2011 |
Junior Member |
|
|
I got like query
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<Afiliacion> query = cb.createQuery(getEntityClass());
Root<Afiliacion> from = query.from(getEntityClass());
query.select(from).
where(cb.and(cb.equal(from.get(Afiliacion_.institucion), institucion),
cb.equal(from.get(Afiliacion_.cerrada), true)
// , from.get(Afiliacion_.recibo).isNull()
));
if I uncomment the line "from.get(Afiliacion_.recibo).isNull()" the query doesn't works.
This is a very simple query and i dont know what can it be wrong
PD: the column on the DB is <null>
and the mapping in Afiliacion.class is:
@ManyToOne
private Recibo recibo; //UNIDIRECTIONAL
here is the problem.. eclipse is looking on Recibo too
SELECT t1.ID, t1.BAJA, t1.BARCODE, t1.CERRADA, t1.CODIGO, t1.CREATION, t1.OBSERVACION, t1.INSTITUCION_ID, t1.RECIBO_ID, t1.SECTOR_ID, t1.USUARIO_ID FROM RECIBO t0, AFILIACION t1 WHERE ((((t1.INSTITUCION_ID = ?) AND (t1.CERRADA = ?)) AND (t1.RECIBO_ID IS NULL)) AND (t0.ID = t1.RECIBO_ID))
how could I avoid this behavior?
[Updated on: Mon, 12 March 2012 12:43] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03460 seconds