-->
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: query fails every second time !
PostPosted: Tue Apr 20, 2004 4:40 am 
Newbie

Joined: Mon Apr 05, 2004 3:14 am
Posts: 13
hi,

i am executing a native sql to get a value.

this query fails the first time i call the web page.

second time, it produces correct result.


List list = session.createSQLQuery(" select max(CAST(substring(p1.part_category_id,9,25) as int)) as {p1.part_category_id} from part_category_master {p1} where p1.part_category_id like 'partcat%' ","p1",part_category_master.class).list();

meaning: substring a field to get integer and then return its max value in table. (so i can create new key)

error message on console is :

Hibernate: select max(CAST(substring(p1.part_category_id,9,25) as int)) as part_category_id0_ from part_category_master p1 where p1.part_category_id like 'partcat%'
WARN [HttpProcessor[8080][4]] (JDBCExceptionReporter.java:38) - SQL Error: 0, SQLState: 42S22
ERROR [HttpProcessor[8080][4]] (JDBCExceptionReporter.java:46) - [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: part_cat2_0_
WARN [HttpProcessor[8080][4]] (JDBCExceptionReporter.java:38) - SQL Error: 0, SQLState: 42S22
ERROR [HttpProcessor[8080][4]] (JDBCExceptionReporter.java:46) - [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: part_cat2_0_
ERROR [HttpProcessor[8080][4]] (JDBCException.java:38) - SQLException occurred
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: part_cat2_0_

where is this part_cat2_0_ coming from the first time ?

is it because of MS Sql , i am using Microsoft driver.

any tips are welcome.

thanks in advance.


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.