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: formula query not working with ROW_NUMBER ,PARTITION, OVER
PostPosted: Sun May 17, 2009 12:05 am 
Newbie

Joined: Mon Sep 15, 2008 8:30 pm
Posts: 7
Hi,

When used the reserved words ROW_NUMBER ,PARTITION and OVER in formula query I am getting the error "ORA-00923: FROM keyword not found where expected".

This is because Hibernate prefixes my formula query and
doesn't seem to recognize the reserved words ROW_NUMBER PARTITION ,OVER , connect , start with etc.

Below is the my formula query.

<property
name="previousProcessDates"
type="java.lang.String"
formula="(select b.CREATE_DATE from (
(select substr(SYS_CONNECT_BY_PATH( CREATE_DATE, ','),2) CREATE_DATE
from ( select
distinct dtb.account_id,
dtb.CREATE_DATE,
count(*) OVER ( partition by account_id ) as cnt,
ROW_NUMBER () OVER ( partition by account_id order by account_id) as seq
from dmd_territory_backfill dtb
where dtb.account_id= account_id
and dtb.status = 'COMPLETE' ) a
where a.seq = a.cnt start with a.seq = 1 connect by prior a.seq+1= a.seq) b)

Hibernate prefixes the above mentioned reserved words with dmdterrito0_. Please see below.

select b.CREATE_DATE from ( (select substr(SYS_CONNECT_BY_PATH( dmdterrito0_.CREATE_DATE, ','),2)
dmdterrito0_.CREATE_DATE
from ( select distinct dtb.account_id, dtb.CREATE_DATE,
count(*) dmdterrito0_.OVER ( dmdterrito0_.partition by dmdterrito0_.account_id ) as dmdterrito0_.cnt,
dmdterrito0_.ROW_NUMBER () dmdterrito0_.OVER ( dmdterrito0_.partition by
dmdterrito0_.account_id
order by dmdterrito0_.account_id) as dmdterrito0_.seq
from dmd_territory_backfill dtb
where dtb.account_id= dmdterrito0_.account_id
and dtb.status = 'COMPLETE' ) dmdterrito0_.a
where a.seq = a.cnt dmdterrito0_.start dmdterrito0_.with a.seq = 1
dmdterrito0_.connect by dmdterrito0_.prior a.seq+1= a.seq) dmdterrito0_.b) )
as formula0_0_ from DMD.DMD_TERRITORY_BACKFILL dmdterrito0_
where dmdterrito0_.TERRITORY_ID in
(select this_.TERRITORY_ID from DMD.DMD_Territory this_ where this_.TERRITORY_ID i( ?) )

Is there any way to tell Hibernate not to do this?

Very greatful for any help on this issue.

Thanks
Kishore


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.