openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phill Moran" <pjmo...@rogers.com>
Subject RE: Named query created in error
Date Thu, 19 Apr 2007 13:05:41 GMT
I am using MySQL version 5
The stack trace only shows because  have wrapped this in a try/catch. The
exception becomes NPE due to  OpenJPA trying to make a Person object form more
than just Person Object data, it fails to do this (silently) and the object it
was to be assigned to become an NP

I use annotations for this project so no ORM file

Nothing in the persistence.xml except class names (all persistable classes
represented in here) and OpenJPA settings.
Interesting questions on why the duplicate query exception suddenly showing up,
but a search on workspace tells me it is the only one with that name
Store is annotated as well. In fact both Person and Store both have other named
queries in them that are working. I also get other reports of dup queries and
they work as well. Another thread (Patrick I believe) described the reason for
these but not sure the impact of them

Here is the whole trace-not sure why the whole thing did not show up before

<0|false|0.9.6-incubating> org.apache.openjpa.persistence.PersistenceException:
null
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:851)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:748)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:773)
	at
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:254)
	at
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2115)
	at
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:248)
	at
org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(Inst
anceResultObjectProvider.java:56)
	at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:33)
	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1203)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:979)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:832)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:763)
	at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:520)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:212)
	at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251)
	at
ca.BidSpec.emall.user.PersonFactoryImpl.getLoginPersonValueObject(PersonFactoryI
mpl.java:98)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils
.java:304)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(Ref
lectiveMethodInvocation.java:172)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:139)
	at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Transa
ctionInterceptor.java:107)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:161)
	at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.j
ava:203)
	at $Proxy34.getLoginPersonValueObject(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils
.java:304)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(Ref
lectiveMethodInvocation.java:172)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:139)
	at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Transa
ctionInterceptor.java:107)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:161)
	at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.j
ava:203)
	at $Proxy34.getLoginPersonValueObject(Unknown Source)
	at
ca.BidSpec.testing.emall.UserFactoryTest.testDelete(UserFactoryTest.java:119)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69
)
	at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ac
cess$001(AbstractAnnotationAwareTransactionalTests.java:47)
	at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.
run(AbstractAnnotationAwareTransactionalTests.java:115)
	at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nTest(AbstractAnnotationAwareTransactionalTests.java:180)
	at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nTestTimed(AbstractAnnotationAwareTransactionalTests.java:153)
	at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nBare(AbstractAnnotationAwareTransactionalTests.java:111)
	at
org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:159)
	at
org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:239)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
	at
org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)
	at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java
:42)
	at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunne
r.java:34)
	at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:38)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:460)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:673)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:386)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:196)
Caused by: java.lang.NullPointerException
	at java.util.Locale.toLowerCase(Locale.java:1060)
	at java.util.Locale.convertOldISOCodes(Locale.java:1083)
	at java.util.Locale.<init>(Locale.java:272)
	at java.util.Locale.<init>(Locale.java:302)
	at ca.BidSpec.emall.user.Person.pcsetLocale(Person.java:375)
	at ca.BidSpec.emall.user.Person.pcClearFields(Person.java)
	at ca.BidSpec.emall.user.Person.pcNewInstance(Person.java)
	at
org.apache.openjpa.enhance.PCRegistry.newInstance(PCRegistry.java:117)
	at
org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:247)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager
.java:327)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java
:252)
	at
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManag
er.java:108)
	at
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:54)
	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:870)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:828)
	... 69 more
This is all I get



-----Original Message-----
From: eljotpl@gmail.com [mailto:eljotpl@gmail.com] On Behalf Of Jacek Laskowski
Sent: April 19, 2007 2:18 AM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Named query created in error

On 4/19/07, Phill Moran <pjmoran@rogers.com> wrote:
> Here it is:
>
> [2007-04-18 18:37:07,937] INFO  
> ca.BidSpec.testing.emall.UserFactoryTest Began transaction (1): 
> transaction manager 
> [org.springframework.orm.jpa.JpaTransactionManager@749ebc]; default rollback =
true
> 25547  WARN   [main] openjpa.MetaData - Found duplicate query
> "PersonFXLastFirst" in "class ca.BidSpec.emall.user.Person".  Ignoring.
> 33360  TRACE  [main] openjpa.jdbc.SQL - <t 19399109, conn 28442012> 
> executing prepstmnt 23861335 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, t5.id, t5.lastUpdated, 
> t5.created, t5.description, t5.displayName, t5.name, t6.id, 
> t6.lastUpdated, t6.description, t6.categoryTypeFK, t6.value, t0.title, 
> t0.visible FROM bidspec.person t0 INNER JOIN bidspec.manufacturer t1 
> ON t0.manufacturerFK = t1.id LEFT OUTER JOIN bidspec.category t2 ON 
> t0.roleFK = t2.id LEFT OUTER JOIN bidspec.category t4 ON 
> t0.salutationFK = t4.id LEFT OUTER JOIN bidspec.manufacturer t5 ON 
> t0.manufacturerFK = t5.id LEFT OUTER JOIN bidspec.categorytype t3 ON 
> t2.categoryTypeFK = t3.id LEFT OUTER JOIN bidspec.category t6 ON 
> t5.typeFK = t6.id WHERE (UPPER(t1.name) = ? AND
> UPPER(t0.loginName) = ?) ORDER BY t0.lastName ASC, t0.firstName ASC
> [params=(String) BIDSPEC, (String) PMORAN] 33360  TRACE  [main] 
> openjpa.jdbc.SQL - <t 19399109, conn 28442012> [0 ms] spent 
> <0|false|0.9.6-incubating>
org.apache.openjpa.persistence.PersistenceException:
> null
>         at 
> org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:851)

What database do you use? Show the line where the query is created and the
parameters are passed. How do the persistence.xml look like? Do you happen to
use orm.xml-like files? What Spring version is used?
Show the Person entity (ca.BidSpec.emall.user.Person).

I wonder why you only get the following warning message

25547  WARN   [main] openjpa.MetaData - Found duplicate query
"PersonFXLastFirst" in "class ca.BidSpec.emall.user.Person".  Ignoring.

, but there's no corresponding warning message for the entity behind p.store
(possibly <package>.Store). Do you happen to *not* annotate the Store class with
@Entity? Could you attach the whole TRACE output of OpenJPA execution?

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl


Mime
View raw message