openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phill Moran" <pjmo...@rogers.com>
Subject How to debug object retrieveal in JPA?
Date Thu, 26 Apr 2007 19:39:24 GMT
Community,

How does one go about debugging object retrieval/creation. I continue to have
exceptions and little to go on as far as the cause.
The named JPQL is good since I know it generates a good sql (can trace code and
see it) . I know the sql is good as I can copy/paste it into mysql query
browser, execute and get the correct data back. The problem is that these lines
result in an NPE.

		Query q =
this.getEntityManager().createNamedQuery("PersonFXStoreAndLogin");
		q.setParameter("storeName", storeName.toUpperCase());
		q.setParameter("loginName", loginName.toUpperCase());
		List<Person> results = null;
		try {
		results = (List<Person>) q.getResultList();
		System.out.println(results.size());
		}
		catch(Exception e) {
			e.printStackTrace();
		}
		if (results.isEmpty()) { <- NPE thrown here
			throw new UserNotFoundException("No user found");
		} 
Also the "mappingTool validate" seems to work fine. Of course how would I know
since I can find no description of what a good one looks like but reading it (no
exceptions) seem to make sense. 

Any help would be much appreciated.

Phill


Mime
View raw message