-->
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: Native SQL works on Linux, but not Windows.
PostPosted: Tue Sep 09, 2008 12:29 pm 
Newbie

Joined: Tue Sep 09, 2008 12:07 pm
Posts: 3
I am using Hibernate3 over a Mysql V5 database running under Tomcat V5.

I have two tables, both of which have an attribute (column) with the name “name”. I am driving a native query against the database that joins these two tables and selects both name attributes.

I am using createSQLQuery’s list method (i.e. List result = sess.createSQLQuery(“select ….”).list();).

My select statement looks like this .

select i.id as id , i.name as username, s.name as schoolname from table1 i , table2 s where i.table2id = s.id

I turned on hibername logging and see this :


Code:
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.type.IntegerType - returning '13' as column: id
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.type.StringType - could not read column value from result set: name; Column 'name' not found.
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.jdbc.AbstractBatcher - closing statement
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.jdbc.ConnectionManager - aggressively releasing JDBC connection
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
Sep.09 11:57:09 http-8080-Processor24 org.hibernate.util.JDBCExceptionReporter - could not execute query [select i.id as  id , i.name as username, s.name as schoolname from table1 i , table2 s where i.table2id = s.id ]


If I remove the i.name and s.name columns from the select it runs fine on Windows. And like I said in the title, the original query runs fine on Linux.

If you have seen anything like this you insight would be most welcome.


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.