-->
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: Hibernate+Oracle and Native Sql with where clause
PostPosted: Sun Nov 23, 2008 4:52 am 
Newbie

Joined: Wed Nov 19, 2008 2:04 pm
Posts: 4
Hi,

I need to query oracle 10g and get order number using Hibernate.

for this i though of using native sql.

kept related HB jars in path along with ojdbc14.jar.

I tried using the following queries but could not get the order number through Hibernate.

But when i execute the below queries am getting the order number from SQL prompt.

Am using oracle 10g release 1 and Hibernate 3.2.6.

//String sql="select orderno from orders o where o.typec='s' and o.name='xxxx' and exists(select 'x' from source s where s.id=o.orderno)";

//String sql="select orderno from orders o,source s where o.typec='s' and o.name='xxxx' and s.id=o.orderno";

Scripts
create table orders(orderno number, typec varchar2(10), name varchar2(10));
insert into orders(orderno,typec,name) values(10,'s','xxxx');
insert into orders(orderno,typec,name) values(11,'k','pppp');
insert into orders(orderno,typec,name) values(12,'p','zzzz');
insert into orders(orderno,typec,name) values(13,'l','dddd');

create table source(id number,name varchar2(10));
insert into source(id,name) values(10,'XXXX');
insert into source(id,name) values(11,'zzzz');
insert into source(id,name) values(12,'kkkk');

When executed from SQL prompt.

select orderno from orders o where o.typec='s' and o.name='xxxx' and exists(select 'x' from sou
rce s where s.id=o.orderno);

ORDERNO
----------
10


Is there anything i am missing to keep in path or Hibernate 3.2.6 does not work with Oracle 10g properly.

Is Hibernate 3.2.6 works with Oracle10g.

Or i need to use any other ......?

This is working with MySql5.

I need this to work with Oracle.

Your help is greatly appreciated.

Thanks


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.