-->
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: Wrapping SQL doesn't work with Oracle 9
PostPosted: Tue May 24, 2005 12:14 pm 
Newbie

Joined: Tue May 24, 2005 11:49 am
Posts: 2
I have the following query produced by Hibernate:

select * from ( select distinct document0_.DOC_RSN as DOC_RSN0_, doctype5_.DOC_TYPE as DOC_TYPE1_, workitem1_.PARCEL_ID as PARCEL_ID2_, workitem1_.NODE_ID as NODE_ID2_, workitem1_.WFL_ID as WFL_ID2_, folder3_.FLD_RSN as FLD_RSN3_, subfolder4_.SUB_FLD_RSN as SUB_FLD_1_4_, details2_.A_DETAIL_RSN as A_DETAIL1_5_, document0_.COMMIT_CONFIG_ID as COMMIT_C2_0_, document0_.COMMIT_DATE as COMMIT_D3_0_, document0_.DOC_SCAN_UID as DOC_SCAN4_0_, document0_.DOC_SCAN_DATE as DOC_SCAN5_0_, document0_.DOC_DESC as DOC_DESC0_, document0_.TASK_PAR_STR as TASK_PAR7_0_, document0_.IMAGE_FILE as IMAGE_FILE0_, document0_.IMAGE_LOCATION as IMAGE_LO9_0_, document0_.IMAGE_PAGES as IMAGE_P10_0_, document0_.DOC_CHECK as DOC_CHECK0_, document0_.DOC_CHECK_USER as DOC_CHE12_0_, document0_.DOC_MOD_UID as DOC_MOD13_0_, document0_.DOC_MOD_DATE as DOC_MOD14_0_, document0_.COMMIT_ACCESS_CHR as COMMIT_15_0_, document0_.PARCEL_ID as PARCEL_ID0_, document0_.NODE_ID as NODE_ID0_, document0_.WFL_ID as WFL_ID0_, document0_.BATCH_NO as BATCH_NO0_, document0_.ORIG_DOC_FILE as ORIG_DO20_0_, document0_.COMMIT_ACCESS as COMMIT_21_0_, document0_.CACHE_FLAG as CACHE_FLAG0_, document0_.TEXT_FILE as TEXT_FILE0_, document0_.TASK_ID as TASK_ID0_, document0_.DOC_RSN_REF as DOC_RSN25_0_, document0_.DOC_TYPE as DOC_TYPE0_, document0_.FLD_RSN as FLD_RSN0_, document0_.SUB_FLD_RSN as SUB_FLD28_0_, document0_.A_CONFIRM_DATE as A_CONFIR0_0_, document0_.A_DESCR as A_DESCR0_, document0_.A_CLIENT_CODE as A_CLIENT0_0_, document0_.A_REF as A_REF0_, doctype5_.DOC_TYPE_DESC as DOC_TYPE2_1_, workitem1_.NODE_ID_FROM as NODE_ID_4_2_, workitem1_.NODE_TITLE_FROM as NODE_TIT5_2_, workitem1_.USER_ID_FROM as USER_ID_6_2_, workitem1_.PARCEL_CRT_UID as PARCEL_C7_2_, workitem1_.PARCEL_USER_ID as PARCEL_U8_2_, workitem1_.BAT_ID as BAT_ID2_, workitem1_.FLD_RSN as FLD_RSN2_, workitem1_.IS_PARALLEL as IS_PARA11_2_, workitem1_.PARCEL_ACT_DATE as PARCEL_12_2_, workitem1_.PARCEL_CRT_DATE as PARCEL_13_2_, workitem1_.PARCEL_REC_DATE as PARCEL_14_2_, workitem1_.PARCEL_EXP_DATE as PARCEL_15_2_, workitem1_.BAT_PRIORITY as BAT_PRI16_2_, workitem1_.PARCEL_SUBJECT as PARCEL_17_2_, workitem1_.PARCEL_NOTES as PARCEL_18_2_, workitem1_.PARCEL_TYPE as PARCEL_19_2_, workitem1_.PARCEL_ID as PARCEL_ID2_, workitem1_.WFL_ID as WFL_ID2_, workitem1_.NODE_ID as NODE_ID2_, folder3_.PROCESS_REF as PROCESS_2_3_, folder3_.FLD_SEC_RSN as FLD_SEC_3_3_, folder3_.TOW_ARCHIVED as TOW_ARCH4_3_, folder3_.A_COMPANY as A_COMPANY3_, folder3_.A_BUS_CODE as A_BUS_CODE3_, subfolder4_.SFLD_SEC_RSN as SFLD_SEC2_4_, subfolder4_.FLD_RSN as FLD_RSN4_, subfolder4_.A_PRIORITY as A_PRIORITY4_, subfolder4_.A_START_DATE as A_START_0_4_, subfolder4_.A_FINISH_DATE as A_FINISH0_4_, subfolder4_.A_PROJECT as A_PROJECT4_, details2_.A_DOC_RSN as A_DOC_RSN5_, details2_.A_COMMENT as A_COMMENT5_, details2_.A_DOC_RSN as A_DOC_RSN__, details2_.A_DETAIL_RSN as A_DETAIL1___ from DEM_DOCUMENT document0_ left outer join DEM_BATCHPARCEL workitem1_ on document0_.PARCEL_ID=workitem1_.PARCEL_ID and document0_.NODE_ID=workitem1_.NODE_ID and document0_.WFL_ID=workitem1_.WFL_ID left outer join DEM_DOCDETAIL details2_ on document0_.DOC_RSN=details2_.A_DOC_RSN left outer join DEM_FOLDER folder3_ on document0_.FLD_RSN=folder3_.FLD_RSN left outer join DEM_SUBFOLDER subfolder4_ on document0_.SUB_FLD_RSN=subfolder4_.SUB_FLD_RSN left outer join DEM_DOCTYPE doctype5_ on document0_.DOC_TYPE=doctype5_.DOC_TYPE ) where rownum <= ?

which crashes on Oracle 9 with the following error:
ORA-00918: column ambiguously defined

althrough the query in brackets alone works fine.

The "rownum" presence or absence doesn't change anything.

The problem seems to be too generic to discuss. My naive assumption is that every "select" can be wrapped like this: select * from (any select here) and this is what Hibernate authors seems to think too.

I can't say what is so special about this query since it seems that many other similar queries work without any problem.

The original HQL:
select distinct document from Document as document left join fetch document.workitem left join fetch document.details left join fetch document.folder left join fetch document.subfolder left join fetch document.type

Is it a known Oracle 9 issue? Did I miss something?


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.