-->
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.  [ 3 posts ] 
Author Message
 Post subject: GenericJDBCException: could not execute query??? add_months
PostPosted: Fri Sep 22, 2006 7:36 am 
Newbie

Joined: Tue May 24, 2005 4:18 am
Posts: 8
Location: Hyderabad
Hi,

Code:
List lst = session.createQuery("select add_months(ep.meetingDate,12)-1  from EpPmsPtlDtls ep where ep.ptlDtlsId="+ptlDtlsId).list();


I got the following exception with the above code.

Code:
at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateC
onverter.java:91)
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43
)
        at org.hibernate.loader.Loader.doList(Loader.java:2150)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
        at org.hibernate.loader.Loader.list(Loader.java:2021)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:298)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:137)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1014)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at com.ksi.ep.dao.pms.persistence.hibernate.ProtocolReviewDAOImpl.getExpireDate(Pr
otocolReviewDAOImpl.java:477)
        ... 23 more
Caused by: java.sql.SQLException: Invalid column type: getInt not implemented for class or
acle.jdbc.driver.T4CDateAccessor
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
        at oracle.jdbc.driver.Accessor.unimpl(Accessor.java:358)


Can any one look into it once and tell me the problem & solution.?

I am using hibernate 3.1 version.But i am able to get the result in hibernate ide tools.

Thanks in Advance,
LALITH













[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 23, 2006 9:41 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
Code:
SQLQuery query = session.createSQLQuery("select add_months(ep.meetingDate,12)-1  from EpPmsPtlDtls ep where ep.ptlDtlsId= :ptlDtlsId");

query.setString("ptlDtlsId", ptlDtlsId);
query.list();

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject: GenericJDBCException: could not execute query??? add_months
PostPosted: Mon Sep 25, 2006 3:57 am 
Newbie

Joined: Tue May 24, 2005 4:18 am
Posts: 8
Location: Hyderabad
Hi Pasha,

It is working fine with to_char(..). See the following query:

Code:
protocolList =session.createQuery("select to_char(add_months(ep.meetingDate,12)-1,'MM/dd/yyyy')  " +
               " from EpPmsPtlDtls ep where ep.ptlDtlsId="+ptlDtlsId).list();



Thanks,
LALITH


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.