Hello. There is written in javadoc, that fetchOne() "Returns: The resulting values.". I have the following query:
int JobID = sqlFactory.select(Job.ID).from(Job.JOB).where(Job.POSITION.notEqual(0), Job.STATUS.equal(JobStatus.QUEUED)).orderBy(Job.POSITION).limit(1).fetchOne(Job.ID); And I think this line can throw NullReferenceException in case SELECT finds no rows matching conditions (underlying call to fetchOne(), returning Record will return null in this case). And implicit cast to int will get us NullReferenceException. I think this should be explicitly documented, that generic method fetchOne() can return null also (not only "the resulting values") and null means - no rows were found by SELECT query. It's especially important when working with generic fetchOne() methods, returning simple types like Integer since they are implicitly cast into their non-object counterparts like int.
