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 Mon, 21 May 2007 14:17:47 GMT
> @DiscriminatorColumn(discriminatorType=DiscriminatorType.CHAR)
> @DiscriminatorValue(value="S")

The discriminator type is CHAR but the value is a String. How about
declaring the type as STRING of length 1?
 @DiscriminatorColumn(discriminatorType=DiscriminatorType.STRING,
length=1)



Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Praveen G [mailto:praveenkumar.gandla@emagia.com] 
Sent: Saturday, May 19, 2007 8:37 AM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Exception while retrieving the data from database

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(DB2Dictionar
y.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(JDBCStoreMana
ger.java:260)
 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)
 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.vormetric.server.dao.audit.hibernate.AuditDAOImpl.purgeDebugMessages
(AuditDAOImpl.java:195)
 at
com.vormetric.server.messageanalyzer.MessageAnalyzerManager.purgeDebugMe
ssages(MessageAnalyzerManager.java:113)
 at
com.vormetric.server.mgmt.ConsoleManagement.purgeDebugMessages(ConsoleMa
nagement.java:675)
 at
com.vormetric.server.mgmt.console.log.LogAnalyzerAction.execute(LogAnaly
zerAction.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.vormetric.server.mgmt.console.access.AuthorizationFilter.doFilter(Au
thorizationFilter.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: 
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(DelegatingResultS
et.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(ResultSetRes
ult.java:288)
 at
org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetR
esult.java:356)
 at
org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java
:662)
 at
org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore(Hand
lerStrategies.java:205)
 at
org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFie
ldStrategy.java:172)
 at
org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:788)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.ja
va:833)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.ja
va:806)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.ja
va:785)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStor
eManager.java:336)
 at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreMana
ger.java:255)

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