When I am concatenating fields in em.CreateQuery concat
returns NULL, cause one of my fields can have NULL. I want check for NULL as in Native MSSQL ISNULL(field,'somthing') function.
MyQuery is.
entManager.createQuery("SELECT NEW " + ThumbNail.class.getName() + "(p.id,p.thumbnail,p.thumbNailModifiedDate, CONCAT(p.firstName,' ',p.lastName,' ',p.middleName)) FROM Person p").setHint("eclipselink.refresh", "true").getResultList();
Tried this one too
entManager.createQuery("SELECT NEW " + ThumbNail.class.getName() + "(p.id,p.thumbnail,p.thumbNailModifiedDate, CONCAT(FUNC('ISNULL',p.firstName,''),' ',FUNC('ISNULL',p.lastName,''),' ',FUNC('ISNULL',p.middleName,'')) FROM Person p").setHint("eclipselink.refresh", "true").getResultList();
And it didn't work
SOLVED! But not with JPQL functions.
I just added new constructor to my pojo object and filled it with JPQL then concated there with checkig for null. Thanx guys for answers.