-->
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: Hibernate : using MINUS in createSQLQuery - Reply this mail
PostPosted: Tue Aug 29, 2006 9:24 am 
Newbie

Joined: Thu Aug 17, 2006 8:13 am
Posts: 8
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:3.0[/b]

[b]Mapping documents:
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@XXXX:project</property>
<property name="hibernate.connection.username">scott</property>
<property name="hibernate.connection.password">tiger</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="player.hbm.xml"/>
</session-factory>
[/b]

[b] Session session = factory.openSession();
Transaction txShow = session.beginTransaction();
player p1=new player();
String query2 = " SELECT {t1}.ID as {t1.id} , {t1}.NAME as {t1.name} FROM PLAYERTABLE t1 where rownum < 20 MINUS select {t1}.ID as {t1.id} ,{t1}.NAME as {t1.name} FROM PLAYERTABLE t1 where rownum < 10 " ;
List l = session.createSQLQuery(query2)
.addEntity("t1", player.class)
.list();
out.println("Show Starts-----2---Length+"+l.size());
txShow.commit();
session.flush();
session.close();

[/b][b]
i have the player class file having all getter and setter method .

[/b]

[b]Full stack trace of any exception that occurs:
org.hibernate.exception.GenericJDBCException: could not execute query 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:1596) at org.hibernate.loader.Loader.list(Loader.java:1577) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153) at hiberservlet.doPost(hiberservlet.java:166) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:536) Caused by: java.sql.SQLException: No more data to read from socket at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160) at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:963) at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:893) at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:101) at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:720) at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:717) at oracle.jdbc.driver.OraclePreparedStatement.privateClose(OraclePreparedStatement.java:489) at oracle.jdbc.driver.OraclePreparedStatement.close(OraclePreparedStatement.java:396) at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:417) at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:197) at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:213) at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:143) at org.hibernate.loader.Loader.getResultSet(Loader.java:1281) at org.hibernate.loader.Loader.doQuery(Loader.java:391) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218) at org.hibernate.loader.Loader.doList(Loader.java:1593) ... 36 more


[/b]

[b]Name and version of the database you are using:[/b]

[b]The generated SQL (show_sql=true): in Tomcat4.1 console the error is as
Hibernate: SELECT t1.ID as ID0_ , t1.NAME as name0_0_ FROM PLAYERTABLE t1 where
rownum < 20 MINUS select t1.ID as ID0_ ,t1.NAME as name0_0_ FROM PLAYERTABLE t1 where rownum < 10
2006-08-29 18:39:11,759 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 17410, SQLState: null>
2006-08-29 18:39:11,759 ERROR [org.hibernate.util.JDBCExceptionReporter] - No more data to read from socket>
[/b]
[b] if i will use simple session.createQuery(
" FROM player where rownum < 20 minus FROM player where rownum < 10 " ).list();
the error is you can not use MINUS in the query .
[/b]

So how to execute the above query using minus and rownum .Please help me to workout above problem .
[b][/b]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 9:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
java.sql.SQLException: No more data to read from socket that is an oracle error, not related to hibernate.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: java.sql.SQLException: No more data to read from socket that
PostPosted: Wed Aug 30, 2006 2:01 am 
Newbie

Joined: Thu Aug 17, 2006 8:13 am
Posts: 8
For the above reason ,

Well, lot's of things *could* be causing this. Off the top of my head, in rough order of likelihood:

1) firewall - personal, on your box, or general, around the database, is reaping long-lived connections
2) connection wrappers on the database - ditto
3) your pooler is configured to terminate connections that are checked out of the pool for too long and you're exceeding that time for some operations
4) your database or it's listener is crashing out from under you (and possibly being auto-restarted by the time you look at it).

but when i am executing some other query (simpe query-from playertable ) it is executing without error .
I think there must be some thing in my query which throws error in oracle .
can some one help me out solving the above query or to overcome the error .


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.