Hi.
I'm getting the following error when trying to run a named query against a view on a Sybase 12.5 database:
util.JDBCExceptionReporter - SQL Error: 0, SQLState: JZ0SP
util.JDBCExceptionReporter - JZ0SP: Invalid ResultSet type: 50200832
Hibernate version: 3.2.5ga
Mapping documents:
Hibernate (not complete)
Code:
<property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.order_updates">true</property>
<property name="jta.UserTransaction">javax/transaction/UserTransaction</property>
<property name="hibernate.jdbc.batch_size">30</property>
<property name="hibernate.max_fetch_depth">3</property>
<property name="hibernate.session_factory_name">HibernateFactory</property>
<property name="connection.datasource">jdbc/MyDataSource</property>
<property name="connection.driver_class">com.sybase.jdbc2.jdbc.SybDriver</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.cache.use_structured_entries">true</property>
<mapping resource="myViewVO.hbm.xml"/>
MyViewVO (not complete)
Code:
<query name="GetData"><![CDATA[
FROM myViewVO WHERE someCol = 186
]]></query>
Code between sessionFactory.openSession() and session.close():Code:
Query namedQuery = session.getNamedQuery("GetData");
List list = namedQuery.list();
System.out.println(list.size());
The following JDBC code works:
Code:
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
String url = "jdbc:sybase:Tds:myServer:myPort/myDb";
Connection conn = DriverManager.getConnection(url, "user", "pwd");
PreparedStatement s = conn.prepareStatement("select * from my_view where some_col = 186");
ResultSet srs = s.executeQuery();
while (srs.next())
{
System.out.println(srs.getRow());
}
The JDBC connection in Weblogic (8.1 SP3) that hibernate uses has the same Sybase driver as used in the above test.
Any ideas?