openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar" <ppod...@bea.com>
Subject RE: Exception while retrieving the data from database
Date Fri, 18 May 2007 17:06:54 GMT
 1. The code snippet and the class definitions as presented in the email
worked without error with MySQL. The error possibly in somewhere else. 
 2. The failure suggests NPE caused by JBoss not finding a class
(LongId?) -- can you switch type of A.id to long from Long and try?  
 3. Looks like your code is querying the extent of B and then deleting
each instance. Please note that JPA supports delete by query which 
avoids fetching instances in memory before deleting them. 
 4. Instances of class B as described here will be stored in the same
table defined for A -- no need to specify it explictly
 5. please post to open-jpa mailing list directly and *not* directly to
my mail address.

Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Praveen G [mailto:praveenkumar.gandla@emagia.com] 
Sent: Friday, May 18, 2007 10:27 AM
To: Pinaki Poddar; open-jpa-dev@incubator.apache.org; Patrick Linskey
Subject: Exception while retrieving the data from database

Hello Pinaki/Patrick,
 
I am having following two classes 
 
@Entity
@Table(name = "LOG_DB2")
public class B extends A {
 @Column(name = "INSTANCE_NAME")
 private String instanceName; 
 
 @Column(name = "DB2_TIMESTAMP")
 private Timestamp db2Timestamp;
 
 @Column(name = "DB_ALIAS")
 private String dbAlias;
 
 @Column(name = "DB_PARTITION")
 private int partitionNum;
 
 
@Entity
@Table(name = "LOG_DB2")
@MappedSuperclass
public class A {
 @Column(name = "LOG_ID")
 @Id
 @GeneratedValue(strategy=GenerationType.IDENTITY)
 private Long id;
 
 @Column(name = "TAG")
 private String tag;
 
 @Column(name = "SUBTAG")
 private String subtag;
 
I am able to store the data into database successfully where as I am
facing the problem while retriveing the data from the database, the
following is the code and highlighted the problem area in the code
 
em=ServiceLocator.getOpenJPASession("pu1");
em.getTransaction().begin();
Query q = em.createQuery("select ad from B ad"); for (B l :
(List<B>)q.getResultList()) {  System.out.println("Host Name is :
"+l.getHostName()+" Instance Name is "+l.getInstanceName());
em.remove(l); } em.getTransaction().commit();
 
The following error occurs
 
<0.9.7-incubating nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: null  at
org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:857)
 at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:756)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.ja
va:776)
 at
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:257)
 at
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java
:2152)
 at
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:251)
 at
org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObj
ect(InstanceResultObjectProvider.java:59)
 at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:3
6)
 at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1219)
 at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:987)
 at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:796)
 at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:766)
 at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:762)
 at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:5
17)
 at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:230)
 at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:26
9)
 at
com.server.dao.audit.hibernate.AuditDAOImpl.purgeDebugMessages(AuditDAOI
mpl.java:196)
 at
com.server.messageanalyzer.MessageAnalyzerManager.purgeDebugMessages(Mes
sageAnalyzerManager.java:113)
 at
com.server.mgmt.ConsoleManagement.purgeDebugMessages(ConsoleManagement.j
ava:675)
 at
com.server.mgmt.console.log.LogAnalyzerAction.execute(LogAnalyzerAction.
java:217)
 at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:431)
 at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
236)
 at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
 at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
 at
com.server.mgmt.console.access.AuthorizationFilter.doFilter(Authorizatio
nFilter.java:70)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
 at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilte
r.java:96)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
 at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAs
sociationValve.java:175)
 at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.j
ava:74)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)
 at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:664)
 at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
 at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:80)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)
 at java.lang.Thread.run(Thread.java:803)
Caused by: 
java.lang.NullPointerException
 at
org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoad
er.java:620)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:602)
 at
org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClass
Loader.java:464)
 at
org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoad
er.java:405)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:568)
 at com.server.dao.audit.A.pcCopyKeyFieldsFromObjectId(A.java)
 at com.server.dao.audit.B.pcNewInstance(B.java)
 at
org.apache.openjpa.enhance.PCRegistry.newInstance(PCRegistry.java:121)
 at
org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.j
ava:250)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStor
eManager.java:330)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreMana
ger.java:255)
 at
org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingSt
oreManager.java:111)
 at
org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.jav
a:57)
 at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:876)
 at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:834)
 
Please help me to resolve the above problem as soon as possible.
 
Thanks,
Praveen Kumar.

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