-->
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.  [ 6 posts ] 
Author Message
 Post subject: GenericJDBCException: could not execute query on list
PostPosted: Fri Dec 07, 2007 6:41 am 
Newbie

Joined: Fri Dec 07, 2007 6:34 am
Posts: 5
Hi all,
I have the following code:

Query query = session.createQuery("select p from Project p");
System.out.println("List" + query.list());

But on 'query.list()' operation it gives :

org.hibernate.exception.GenericJDBCException: could not execute query

If I run query like :
select p.projectId from Project p

It is running.
But query like : 'from project' - It is throwing an exception.

Please help me out


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 1:12 pm 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

Try this,
Query query = session.createQuery("from Project p");
System.out.println("List" + query.list());

Look into the link below
http://www.hibernate.org/hib_docs/v3/re ... ryhql.html

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 09, 2007 9:25 am 
Newbie

Joined: Fri Dec 07, 2007 6:34 am
Posts: 5
Hi
I tried this too, but still it is giving the same prob...


Top
 Profile  
 
 Post subject: Re: GenericJDBCException: could not execute query on list
PostPosted: Tue Dec 11, 2007 5:35 am 
Newbie

Joined: Fri Dec 07, 2007 6:34 am
Posts: 5
chanchalkumari wrote:
Hi all,
I have the following code:

Query query = session.createQuery(" from Project p");
System.out.println("List" + query.list());
If there are record in the table then
on 'query.list()' operation it gives :

org.hibernate.exception.GenericJDBCException: could not execute query

But If there are NO records in the table then it is running fine and gives the number of records as 0.


Please help me out


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 11, 2007 9:28 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Give us the Project java class mapping file..and the full exception..

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject: Re: GenericJDBCException: could not execute query on list
PostPosted: Thu May 07, 2009 2:15 am 
Newbie

Joined: Thu May 07, 2009 1:50 am
Posts: 3
I had a similar problem.

org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1565)
at org.hibernate.loader.Loader.list(Loader.java:1545)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:840)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at SimpleRetrieveTest.listEvents(SimpleRetrieveTest.java:131)
at SimpleRetrieveTest.task(SimpleRetrieveTest.java:114)
at SimpleRetrieveTest.access$000(SimpleRetrieveTest.java:11)
at SimpleRetrieveTest$HealthCheckTask.run(SimpleRetrieveTest.java:139)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 31 ms ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3009)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2895)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3438)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1912)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1239)
at org.hibernate.loader.Loader.doQuery(Loader.java:374)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
at org.hibernate.loader.Loader.doList(Loader.java:1562)
... 11 more
Caused by: java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2452)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2906)
... 23 more

The above happens only when querying list(). Is does not occur while performing other operations.

I tried to configure the c3p0 properties. Check this http://hibernatedb.blogspot.com/2009/05 ... te-to.html


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