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: Exception while retrieving the data from database
Date Sat, 19 May 2007 16:59:43 GMT
Praveen-

It looks like we might be calling getInt() on a column type that  
isn't compatible. How are the columns defined for your tables? For  
example, if "DB_PARTITION" is really a VARCHAR, then I can see this  
happening.

If that is the case, then you might be able to get around it by  
specifying @org.apache.openjpa.persistence.Type(String.class) on the  
offending field.



On May 19, 2007, at 6:37 AM, Praveen G wrote:

> Hi,
>
> I am having following two classes, modified the code as follows
>
> @Entity
> @Table(name = "LOG_DB2")
> @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
> @DiscriminatorColumn(discriminatorType=DiscriminatorType.CHAR)
> @DiscriminatorValue(value="S")
> 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;
>
>  @Column(name = "HOST_NAME")
>  private String hostName;
>
>
>
>
> @Entity
> @Table(name = "LOG_DB2")
> @DiscriminatorValue(value="C")
> 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;
>
> 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("audit");
> em.getTransaction().begin();
>
> Query q = em.createQuery("select ad from B ad");
> List<B> logs = q.getResultList();
> for (B l : logs) {
> System.out.println("Host Name is : "+l.getHostName()+" Instance  
> Name is "+l.getInstanceName());
> em.remove(l);
> }
>
> em.getTransaction().commit();
> em.close();
>
>
> The following error occurs
>
> <0.9.7-incubating nonfatal general error>  
> org.apache.openjpa.persistence.PersistenceException: [IBM][CLI  
> Driver] CLI0112E  Error in assignment. SQLSTATE=22005
>  at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException 
> (DBDictionary.java:3784)
>  at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException 
> (DB2Dictionary.java:373)
>  at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore 
> (SQLExceptions.java:97)
>  at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore 
> (SQLExceptions.java:83)
>  at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore 
> (SQLExceptions.java:59)
>  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize 
> (JDBCStoreManager.java:260)
>  at org.apache.openjpa.kernel.DelegatingStoreManager.initialize 
> (DelegatingStoreManager.java:111)
>  at org.apache.openjpa.kernel.ROPStoreManager.initialize 
> (ROPStoreManager.java:57)
>  at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java: 
> 876)
>  at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:834)
>  at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:756)
>  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load 
> (JDBCStoreManager.java: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.getResultO 
> bject(InstanceResultObjectProvider.java:59)
>  at org.apache.openjpa.lib.rop.EagerResultList.<init> 
> (EagerResultList.java:36)
>  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:517)
>  at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java: 
> 230)
>  at org.apache.openjpa.persistence.QueryImpl.getResultList 
> (QueryImpl.java:269)
>  at  
> com.vormetric.server.dao.audit.hibernate.AuditDAOImpl.purgeDebugMessag 
> es(AuditDAOImpl.java:195)
>  at  
> com.vormetric.server.messageanalyzer.MessageAnalyzerManager.purgeDebug 
> Messages(MessageAnalyzerManager.java:113)
>  at com.vormetric.server.mgmt.ConsoleManagement.purgeDebugMessages 
> (ConsoleManagement.java:675)
>  at com.vormetric.server.mgmt.console.log.LogAnalyzerAction.execute 
> (LogAnalyzerAction.java:217)
>  at org.apache.struts.action.RequestProcessor.processActionPerform 
> (RequestProcessor.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 
> (ApplicationFilterChain.java:252)
>  at org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterChain.java:173)
>  at  
> com.vormetric.server.mgmt.console.access.AuthorizationFilter.doFilter( 
> AuthorizationFilter.java:70)
>  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
> (ApplicationFilterChain.java:202)
>  at org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterChain.java:173)
>  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter 
> (ReplyHeaderFilter.java:96)
>  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter 
> (ApplicationFilterChain.java:202)
>  at org.apache.catalina.core.ApplicationFilterChain.doFilter 
> (ApplicationFilterChain.java:173)
>  at org.apache.catalina.core.StandardWrapperValve.invoke 
> (StandardWrapperValve.java:213)
>  at org.apache.catalina.core.StandardContextValve.invoke 
> (StandardContextValve.java:178)
>  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke 
> (SecurityAssociationValve.java:175)
>  at org.jboss.web.tomcat.security.JaccContextValve.invoke 
> (JaccContextValve.java: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:148)
>  at org.apache.coyote.http11.Http11Processor.process 
> (Http11Processor.java:869)
>  at org.apache.coyote.http11.Http11BaseProtocol 
> $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java: 
> 664)
>  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket 
> (PoolTcpEndpoint.java:527)
>  at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt 
> (LeaderFollowerWorkerThread.java:80)
>  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run 
> (ThreadPool.java:684)
>  at java.lang.Thread.run(Thread.java:803)
> Caused by:
> COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0112E  Error in  
> assignment. SQLSTATE=22005
>  at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException 
> (Unknown Source)
>  at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException 
> (Unknown Source)
>  at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code 
> (Unknown Source)
>  at COM.ibm.db2.jdbc.app.DB2ResultSet.getInt2(Unknown Source)
>  at COM.ibm.db2.jdbc.app.DB2ResultSet.getInt(Unknown Source)
>  at org.apache.openjpa.lib.jdbc.DelegatingResultSet.getInt 
> (DelegatingResultSet.java:134)
>  at org.apache.openjpa.jdbc.sql.DBDictionary.getInt 
> (DBDictionary.java:643)
>  at org.apache.openjpa.jdbc.sql.DBDictionary.getChar 
> (DBDictionary.java:545)
>  at org.apache.openjpa.jdbc.sql.ResultSetResult.getCharInternal 
> (ResultSetResult.java:288)
>  at org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal 
> (ResultSetResult.java:356)
>  at org.apache.openjpa.jdbc.sql.AbstractResult.getObject 
> (AbstractResult.java:662)
>  at  
> org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore 
> (HandlerStrategies.java:205)
>  at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load 
> (HandlerFieldStrategy.java:172)
>  at org.apache.openjpa.jdbc.meta.FieldMapping.load 
> (FieldMapping.java:788)
>  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load 
> (JDBCStoreManager.java:833)
>  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load 
> (JDBCStoreManager.java:806)
>  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load 
> (JDBCStoreManager.java:785)
>  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState 
> (JDBCStoreManager.java:336)
>  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize 
> (JDBCStoreManager.java:255)
>
> Please help me to resolve the above problem as soon as possible.
>
> Thanks,
> Praveen Kumar.


Mime
View raw message