openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: How to debug object retrieveal in JPA?
Date Thu, 26 Apr 2007 19:50:06 GMT
Could you post the full NPE? Is results null, or is the NPE coming from
within OpenJPA somewhere? OpenJPA shouldn't be returning a null
collection in any situation, I don't think.

One way to fish for causes of suspicious problems is to set the default
log level to TRACE:

<property name="openjpa.Log" value="DefaultLevel=TRACE"/>

This will generate tons of output, but the stuff towards the end might
provide something of value.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc.
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Phill Moran [mailto:pjmoran@rogers.com] 
> Sent: Thursday, April 26, 2007 12:39 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: How to debug object retrieveal in JPA?
> 
> 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
> 
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA
Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,
 copyrighted  and/or legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient, and have received
this message in error, please immediately return this by email and then delete it.

Mime
View raw message