-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: org.hibernate.exception.SQLGrammarException:
PostPosted: Wed May 07, 2014 10:44 pm 
Newbie

Joined: Mon Mar 03, 2014 5:33 pm
Posts: 4
Hello All

The Code below is throwing an Exception

@SuppressWarnings("unchecked")

public int updatePurgeDate(LogInfo instance) throws Exception{
log.debug("updateing purge date LogInfo instance");
try{

Criteria criteria =getSession().createCriteria("ups.scs.elf.dao.LogInfo").setProjection(Projections.max("logTime"));
Criterion criterion1 = Restrictions.eq("message", instance.getMessage());
Criterion criterion2 = Restrictions.eq("trackingId", instance.getTrackingId());
LogicalExpression andEx = Restrictions.and(criterion1, criterion2);
criteria.add(andEx);
List<java.util.Date> results = criteria.list();


String updateQuery = "UPDATE LOG_INFOS set PURGE_DATE = :updatedpurgedate WHERE LOG_TIME = :LOGTIME and TRACKING_ID = :trackingId " ;

Query query = getSession().createSQLQuery(updateQuery);

query.setParameter("updatedpurgedate",instance.getPurgeDate());
query.setParameter("LOGTIME", results.get(0));
query.setParameter("trackingId",instance.getTrackingId());
int result = query.executeUpdate();

return result;

}catch (RuntimeException re) {
log.error("update purgeDate failed", re);
throw re;
}

I am getting the below Exception stack trace when executing the above code. Could you please help



Exception stack trace:
org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:198)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1190)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:357)
at ups.scs.elf.dao.LogInfosDAO.updatePurgeDate(LogInfosDAO.java:207)
at ups.scs.elf.dao.ElfDAOUtils.updatePurgeDate(ElfDAOUtils.java:968)
at ups.scs.sip.mdbhandlers.DatabaseTrackerHandler.handleMWMessage(DatabaseTrackerHandler.java:135)
at ups.scs.sip.mdbhandlers.BaseMWMessageHandler.handleMessage(BaseMWMessageHandler.java:423)
at ups.scs.sip.mdbhandlers.BaseMWMessageHandler.handleMessage(BaseMWMessageHandler.java:357)
at ups.scs.common.ejb.mdb.GenericUMSMDB.onMessage(GenericUMSMDB.java:892)
at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:585)
at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:488)
at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:385)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3821)
at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.sql.SQLException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:626)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:630)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1081)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2907)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2977)
at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:167)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:189)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1190)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:357)
at ups.scs.elf.dao.LogInfosDAO.updatePurgeDate(LogInfosDAO.java:207)
at ups.scs.elf.dao.ElfDAOUtils.updatePurgeDate(ElfDAOUtils.java:968)
at ups.scs.sip.mdbhandlers.DatabaseTrackerHandler.handleMWMessage(DatabaseTrackerHandler.java:136)
at ups.scs.sip.mdbhandlers.BaseMWMessageHandler.handleMessage(BaseMWMessageHandler.java:423)
at ups.scs.sip.mdbhandlers.BaseMWMessageHandler.handleMessage(BaseMWMessageHandler.java:357)
at ups.scs.common.ejb.mdb.GenericUMSMDB.onMessage(GenericUMSMDB.java:892)
at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:385)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3822)
at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
... 1 more


Top
 Profile  
 
 Post subject: Re: org.hibernate.exception.SQLGrammarException:
PostPosted: Fri May 09, 2014 1:37 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
"Caused by: java.sql.SQLException: ORA-00942: table or view does not exist"

Does the table LOG_INFOS exist? Is it "reachable" for the user in your hibernate configuration?


Top
 Profile  
 
 Post subject: Re: org.hibernate.exception.SQLGrammarException:
PostPosted: Fri May 09, 2014 11:01 am 
Newbie

Joined: Mon Mar 03, 2014 5:33 pm
Posts: 4
Yes the table exists and is reachable to the user. actually the hibernate code was working in Test environment/Test Database. It is not working in Staging Environment/Staging database, It throws the above error. Do you think if it is related to any permissions or privileges issue?

Thanks
Kalyan


Top
 Profile  
 
 Post subject: Re: org.hibernate.exception.SQLGrammarException:
PostPosted: Fri Jun 13, 2014 11:30 am 
Newbie

Joined: Mon Mar 03, 2014 5:33 pm
Posts: 4
Public synonym is missing on the table. It was fixed after the DBA put the public synonym on the table.

Thanks
Kalyan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.