openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phill Moran" <pjmo...@rogers.com>
Subject RE: How to debug object retrieveal in JPA?
Date Thu, 26 Apr 2007 20:44:21 GMT
Some more information on this exception

Right after the execution the exception held inside the result is
"com.sun.jdi.InvocationException occurred invoking method..." Can't seem to get
more data out of it 

Once the system.out is executed the exception changes to "The result list has
been closed"

-----Original Message-----
From: Phill Moran [mailto:pjmoran@rogers.com] 
Sent: April 26, 2007 4:18 PM
To: open-jpa-dev@incubator.apache.org
Subject: RE: How to debug object retrieveal in JPA?

I did not mean it threw an NPE but I was left with a null result list. 

I have setup trace already and I actually get nothing back. Here is the trace
across the execution point

13734  WARN   [main] openjpa.MetaData - Found duplicate query
"PersonFXLastFirst" in "class ca.BidSpec.emall.user.Person".  Ignoring.
22594  TRACE  [main] openjpa.jdbc.SQL - <t 31845311, conn 9575056> executing
prepstmnt 31103354 SELECT t0.id, t0.lastUpdated, t0.active, t0.activeFrom,
t0.activeUntil, t0.created, t0.displayName, t0.firstName, t0.lastLogin,
t0.lastName, t0.locale, t0.loginName, t0.middleName, t2.id, t2.lastUpdated,
t2.description, t3.id, t3.lastUpdated, t3.description, t2.value, t4.id,
t4.lastUpdated, t4.description, t4.categoryTypeFK, t4.value, t1.id,
t1.lastUpdated, t1.created, t1.description, t1.displayName, t1.name, t5.id,
t5.lastUpdated, t5.description, t5.categoryTypeFK, t5.value, t0.title,
t0.visible FROM person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK =
t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER JOIN category
t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON t1.typeFK = t5.id
LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id WHERE
(UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY t0.lastName ASC,
t0.firstName ASC [params=(String) BIDSPEC, (String) PMORAN]
22609  TRACE  [main] openjpa.jdbc.SQL - <t 31845311, conn 9575056> [15 ms] spent
27469  TRACE  [main] openjpa.jdbc.SQL - <t 31845311, conn 9575056> executing
prepstmnt 3888519 SELECT COUNT(*) FROM person t0 INNER JOIN manufacturer t1 ON
t0.manufacturerFK = t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT
OUTER JOIN category t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON
t1.typeFK = t5.id LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id
WHERE (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) [params=(String) BIDSPEC,
(String) PMORAN]
27469  TRACE  [main] openjpa.jdbc.SQL - <t 31845311, conn 9575056> [0 ms] spent
1
[2007-04-26 16:07:36,125] INFO  ca.BidSpec.testing.emall.UserFactoryTest Rolled
back transaction after test execution 

What is interesting is the line with a "1" (from
System.out.println(results.size())). What this represents is the message that
the "result list is closed" nothing else in the trace. 

So what causes the result list to be closed?

Phill

-----Original Message-----
From: Marc Prud'hommeaux [mailto:mprudhomapache@gmail.com] On Behalf Of Marc
Prud'hommeaux
Sent: April 26, 2007 3:54 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: How to debug object retrieveal in JPA?

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