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.  [ 6 posts ] 
Author Message
 Post subject: Need help for 'Fail to convert to internal representation'
PostPosted: Wed Jun 25, 2008 6:22 am 
Newbie

Joined: Wed Jun 25, 2008 2:59 am
Posts: 2
Location: India
Hi,

I am using Hibernate to get the data from oracle. I am creating a Query as follows..

Query myQuery = session.createQuery("select p.partMasterKey , p.partMasterKeyDisplay ,p.partMasterKeyDesc from Parts p, PartsService si where p.partMasterKey=si.partMasterKey and si.nsqKey="+gsqNumber);

orderList = (ArrayList)myQuery.list();

Whre gsqNumber is comming from page.

I tried to execute the query generated by Hibernate in oracle it looks fine but when i am trying it from front end (java) it is giving following exception....

org.hibernate.util.JDBCExceptionReporter SQL Error: 17059, SQLState: null
org.hibernate.util.JDBCExceptionReporter Fail to convert to internal representation


Full stack trace is...

Caused by: java.sql.SQLException: Fail to convert to internal representation
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at oracle.jdbc.driver.OracleStatement.getIntValue(OracleStatement.java:4479)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:536)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1528)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getInt(WSJdbcResultSet.java:1341)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.type.IntegerType.get(IntegerType.java:26)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.loader.hql.QueryLoader.getResultColumnOrRow(QueryLoader.java:357)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:329)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.loader.Loader.doQuery(Loader.java:412)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R at org.hibernate.loader.Loader.doList(Loader.java:1593)
[6/25/08 15:30:58:795 IST] 10c0da7 SystemErr R ... 221 more

_________________
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 25, 2008 7:29 am 
Beginner
Beginner

Joined: Wed Sep 21, 2005 8:18 am
Posts: 31
Change and replace your query by following

Query myQuery = session.createQuery("select p.partMasterKey , p.partMasterKeyDisplay ,p.partMasterKeyDesc from Parts p where p.partsService.nsqKey ="+gsqNumber);

You don't need to mention PartsService in from clause as you are not retrieving any data from PartsService. When you write p.partsService.nsqKey, hibernate automatically does equijoin between Parts and ParstService.

_________________
amer sohail


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 25, 2008 9:13 am 
Newbie

Joined: Wed Jun 25, 2008 2:59 am
Posts: 2
Location: India
Thanks for valuable help.

Do we need any PartsService object in Parts class?

Query myQuery = session.createQuery("select p.partMasterKey , p.partMasterKeyDisplay ,p.partMasterKeyDesc from Parts p where p.partsService.nsqKey ="+gsqNumber);

Here partsService is property of class or class name.

we have created PartsService Object in Parts class. And tried the above query.

The query generated by Hibernate.....

select p.partMasterKey , p.partMasterKeyDisplay ,p.partMasterKeyDesc from Parts p where p.partService.nsqKey=1024

But getting Exception

could not resolve property: partService of: Parts

My parts.hbm contents join as :

<join table ="ZGSQ_SERVICE_ITEMS_VW" >
<key column="PARTMSTR_KEY"></key>
</join>

Please let me what should we modify to get proper results.

_________________
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 26, 2008 3:09 am 
Beginner
Beginner

Joined: Wed Sep 21, 2005 8:18 am
Posts: 31
In "p.partsService.nsqKey", partsService is property of class Parts. Kindly check spelling and case sensitivity.

_________________
amer sohail


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 26, 2008 3:12 am 
Beginner
Beginner

Joined: Wed Sep 21, 2005 8:18 am
Posts: 31
In "p.partsService.nsqKey", partsService is property of class Parts. Look at the instance variable name of PartService in "Parts" class. use that variable name exactly in place of "partsService". e.g. if you have structure of you parts class as follows;
public class Parts{
private PartsService partsService;
// other code

}

then partsService should be used in query.

_________________
amer sohail


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 26, 2008 3:13 am 
Beginner
Beginner

Joined: Wed Sep 21, 2005 8:18 am
Posts: 31
In "p.partsService.nsqKey", partsService is property of class Parts. Look at the instance variable name of PartService in "Parts" class. use that variable name exactly in place of "partsService". e.g. if you have structure of you parts class as follows;
public class Parts{
private PartsService partsService;
// other code

}

then partsService should be used in query.

_________________
amer sohail


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.