taa_sarge wrote:
I have an attribute that is defined as Integer (we did this because the value could be null).
However, how can I get around the null pointer problem with the following:
Code:
Query query = session.createQuery(hql);
query.setInteger("glUnit",glParameters.getGlUnit().intValue());
Any ideas...
That's more of a standard Java question than a Hibernate question isn't it ?
Just check if the value is null before doing the setInteger(). If you need to be able to find objects where the GlUnit is null, you'd have to write a slightly different query anyway.