-->
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.  [ 7 posts ] 
Author Message
 Post subject: newbie question --> session.createQuery() fails
PostPosted: Fri Nov 11, 2005 1:17 pm 
Newbie

Joined: Fri Nov 11, 2005 12:55 pm
Posts: 6
Hello All,

I am newbie to Hibernate. Today, I am assigned one issue to fix is ASAP. Whenever i execute following query against Oracle database and schema1

[b]session.createQuery("from " + objectName + orderBy)[/b]

i am getting following exception.

[b]org.hibernate.ObjectNotFoundException: No row with the given identifier exists:[/b]

But the same code works fine with schema2. As i have been assigned this task today, i purchases a Hibernate book and started reading it. But its going to take fews days to under stand hibernate. As people wants me to fix this issue ASAP, i will appreciate any pointers or help.

Thanks
Prashant


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 3:13 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
the db w/ schema1 has different data than the db w/ schema2 ?


Top
 Profile  
 
 Post subject: about query
PostPosted: Sat Nov 12, 2005 3:36 am 
Newbie

Joined: Thu Oct 20, 2005 7:48 am
Posts: 19
Hi u r executing createQuery... which follows HQL formate...
so make as string., like

("from " + object + " " + orderby) ..

if u get help from this please vote.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 3:41 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
orderBy is obviously a String.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 3:45 am 
Newbie

Joined: Thu Oct 20, 2005 7:48 am
Posts: 19
i know orderBy is string...
but HQL want is as in string form like
"from customer c order by c.customername"

so there should be space between word so i was telling like this..
thanks..


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 12, 2005 3:47 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
and this explains why it can find a row in one database, but not in another?


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Tue Nov 15, 2005 11:05 am 
Newbie

Joined: Fri Nov 11, 2005 12:55 pm
Posts: 6
Thank you everybody for reply. Because of some data referential integrety issue in schema1, Hibernate was throwing the exceptions. As it works fine with schema2, i compared data in schma1 with schma2 and found out the problem.

Both the objectName and orderBy are string.

I really appreciate all the replies.

Thanks
Prashant


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