public void testMappedQueryObjectWithNullForPrimitiveIntField() throws Exception { h.insert("insert into something (id, name, intValue) values (1, 'eric', null)"); Query<Something> query = h.createQuery("select * from something order by id").map(Something.class); List<Something> r = query.list(); Something eric = r.get(0); assertEquals("eric", eric.getName()); assertEquals(1, eric.getId()); assertEquals(0, eric.getIntValue()); }