-->
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.  [ 1 post ] 
Author Message
 Post subject: java.lang.UnsupportedOperationException in hibernate oper
PostPosted: Wed Aug 17, 2005 12:21 pm 
Newbie

Joined: Wed Aug 17, 2005 12:10 pm
Posts: 2
Hibernate version: 3.0

Mapping documents:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- datasource connection properties -->
<property name="connection.datasource">java:comp/env/jdbc/Book</property>
<property name="hibernate.connection.username">hibernate</property>
<property name="hibernate.connection.password">hibernate</property>
<!-- dialect for MySQL -->
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.connection.provider_class">
org.hibernate.connection.DatasourceConnectionProvider
</property>
<property name="hibernate.jdbc.fetch_size">50</property>
<property name="hibernate.jdbc.batch_size">25</property>

<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>
<mapping resource="TauthBook.hbm.xml" />
<mapping resource="Tauthor.hbm.xml" />
<mapping resource="Tbook.hbm.xml"></mapping>
</session-factory>
</hibernate-configuration>
Code between sessionFactory.openSession() and session.close():
public class TestServlet extends HttpServlet {

public void doGet(HttpServletRequest request,HttpServletResponse resp) throws IOException{
PrintWriter out = resp.getWriter();

Configuration config = new Configuration().configure();

SessionFactory sessionFactory = config.buildSessionFactory();

Session session = sessionFactory.openSession();

String hql = " from Tbook";

Query query = session.createQuery(hql);

Iterator iter = query.iterate();

Tbook info = null;
while (iter.hasNext()){
info = (Tbook)iter.next();
}
}

}
Full stack trace of any exception that occurs:
java.lang.UnsupportedOperationException
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:116)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:554)
org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:57)
org.hibernate.jdbc.AbstractBatcher.openConnection(AbstractBatcher.java:416)
org.hibernate.jdbc.JDBCContext.connect(JDBCContext.java:145)
org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:91)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:86)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1098)
org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:415)
org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:281)
org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:876)
org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:41)
cn.edu.shu.test.TestServlet.doGet(TestServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Name and version of the database you are using:
mysql

the error occure when i invoke the iterator() of query,how can i do with the error?


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

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.