openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Prud'hommeaux <mprud...@apache.org>
Subject Re: How to debug object retrieveal in JPA?
Date Thu, 26 Apr 2007 19:53:55 GMT
Phill-

The maximum verbosity of logging is obtained by specifying the  
"openjpa.Log" property to "DefaultLevel=TRACE".

What is the full exception stack trace? We might be able to help  
identify the problem. In any case OpenJPA should never be throwing an  
NPE, so we should at least probably fix the error message.


On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:

> 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