-->
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: generated subselect for property formula
PostPosted: Sat Feb 24, 2007 11:22 am 
Beginner
Beginner

Joined: Mon Aug 01, 2005 3:51 pm
Posts: 22
I'm using the following formula for a property:
Code:
<property name="Analyzed" type="Boolean"
         formula="(   select
                     'Y'
                  from
                     sample smpl,
                     prep p,
                     mount m,
                     slot_assignment sa,
                     session ses
                  where
                     smpl.id = Id and
                     smpl.id = p.sample_fk and
                     p.id = m.preps_fk and
                     m.id = sa.prep_mount_fk and
                     sa.session_fk = ses.id
               )">
</property>


The generated sql adds "[this_1_]." to the table aliases of the subselect. If I remove these, the query runs fine in sqlserver.

Code:
SELECT this.SAMPLE_FK as ID23_, this.PLANT_FK as PLAN4_218_23_, this.GRADE_FK as GRAD6_218_23_, this.HEAT_NUMBER as HEAT3_218_23_, this.CAST_LINE_FK as CAST8_218_23_, this.CAST_DATE as CAST2_218_23_, this.SAMPLE_LOCATION_FK as SAMP5_218_23_, this.GRADE_TYPE_FK as GRAD7_218_23_, [this_1_].TYPE_FK as TYPE9_166_23_, [this_1_].ORIGIN_FK as ORIG8_166_23_, [this_1_].DESCRIPTION as DESC4_166_23_, [this_1_].LOGIN_DATE as LOGI2_166_23_, [this_1_].CLIENT_SAMPLE_ID_FK as CLIE6_166_23_, [this_1_].PRIMARY_IDENTIFIER_FK as PRIM7_166_23_, [this_1_].COMMENTS as COMM3_166_23_, [this_1_].LOGGED_BY_FK as LOGG5_166_23_, (   select
                     'Y'
                  from
                     sample [this_1_].smpl,
                     prep [this_1_].p,
                     mount [this_1_].m,
                     slot_assignment [this_1_].sa,
                     session [this_1_].ses
                  where
                     smpl.id = [this_1_].Id and
                     smpl.id = p.sample_fk and
                     p.id = m.preps_fk and
                     m.id = sa.prep_mount_fk and
                     sa.session_fk = ses.id
               ) as f0_23_, plantentit1_.ID as ID0_, plantentit1_.LOOKUP_VALUE as LOOKUP_V4_0_, plantentit1_.DESCRIPTION as DESCRIPT3_0_, plantentit1_.SEQUENCE as SEQUENCE0_, gradeentit2_.ID as ID1_, gradeentit2_.LOOKUP_VALUE as LOOKUP_V4_1_, gradeentit2_.DESCRIPTION as DESCRIPT3_1_, gradeentit2_.SEQUENCE as SEQUENCE1_, castlineen3_.ID as ID2_, castlineen3_.LOOKUP_VALUE as LOOKUP_V4_2_, castlineen3_.DESCRIPTION as DESCRIPT3_2_, castlineen3_.SEQUENCE as SEQUENCE2_, sampleloca4_.ID as ID3_, sampleloca4_.LOOKUP_VALUE as LOOKUP_V4_3_, sampleloca4_.DESCRIPTION as DESCRIPT3_3_, sampleloca4_.SEQUENCE as SEQUENCE3_, gradetypee5_.ID as ID4_, gradetypee5_.LOOKUP_VALUE as LOOKUP_V4_4_, gradetypee5_.DESCRIPTION as DESCRIPT3_4_, gradetypee5_.SEQUENCE as SEQUENCE4_, sampletype6_.ID as ID5_, sampletype6_.NAME as NAME5_, sampletype6_.DESCRIPTION as DESCRIPT3_5_, contracten7_.ID as ID6_, contracten7_.CLIENT_CONTRACT_NAME_FK as CLIENT_10_6_, contracten7_.COMMENTS as COMMENTS6_, contracten7_.DUE_DATE as DUE_DATE6_, contracten7_.STATUS_FK as STATUS_FK6_, contracten7_.ACCOUNT_FK as ACCOUNT_FK6_, contracten7_.SERVICE_PROVIDER_FK as SERVICE_7_6_, contracten7_.LOGGED_BY_FK as LOGGED_B6_6_, contracten7_.CLIENT_CONTRACT_ID_FK as CLIENT_C9_6_, contracten7_.JOB_TYPE_FK as JOB_TYP14_6_, contracten7_.RJLG_CONTRACT_ID_FK as RJLG_CON8_6_, contracten7_.BILL_TO_FK as BILL_TO_FK6_, contracten7_.LOGIN_DATE as LOGIN_DATE6_, contracten7_.RJLG_CONTRACT_NAME_FK as RJLG_CO11_6_, contracten7_.TURN_AROUND_TIME_FK as TURN_AR16_6_, contracten7_.TYPE_FK as TYPE_FK6_, identifica8_.ID as ID7_, identifica8_.PARENT_FK as PARENT_FK7_, identifica8_.IDENTITY_LABEL as IDENTITY2_7_, identitysc9_.ID as ID8_, identitysc9_.OWNER_FK as OWNER_FK8_, identitysc9_.NAME as NAME8_, identitysc9_.DESCRIPTION as DESCRIPT3_8_, partyentit10_.ID as ID9_, case when [partyentit10__1_].ID is not null then 1 when [partyentit10__2_].ID is not null then 2 when partyentit10_.ID is not null then 0 end as clazz_9_, partyentit10_.EMAIL_ADDRESS as EMAI2_177_9_, [partyentit10__1_].TITLE as TITLE178_9_, [partyentit10__1_].SALUTATION as SALU3_178_9_, [partyentit10__1_].FIRST_NAME as FIRS4_178_9_, [partyentit10__1_].MIDDLE_NAME as MIDD5_178_9_, [partyentit10__1_].LAST_NAME as LAST6_178_9_, [partyentit10__2_].ORG_NAME as ORG_2_179_9_, [partyentit10__2_].ABBREVIATION as ABBR3_179_9_, [partyentit10__2_].HOMEPAGE_URL as HOME4_179_9_, [partyentit10__2_].GROUP_PREFIX as GROU5_179_9_, statusenti11_.ID as ID10_, statusenti11_.INACTIVE_DATE as INACTIVE3_10_, statusenti11_.TYPE_FK as TYPE_FK10_, statusenti11_.ACTIVE_DATE as ACTIVE_D2_10_, statustype12_.ID as ID11_, statustype12_.NAME as NAME11_, statustype12_.DESCRIPTION as DESCRIPT3_11_, accountent13_.ID as ID12_, accountent13_.TYPE_FK as TYPE_FK12_, accountent13_.CREDIT_STATUS as CREDIT_S3_12_, accountent13_.ACCOUNT_ID as ACCOUNT_ID12_, accountent13_.DEFAULT_BILL_TO_FK as DEFAULT_4_12_, accountent13_.CLIENT_FK as CLIENT_FK12_, accounttyp14_.ID as ID13_, accounttyp14_.NAME as NAME13_, accounttyp14_.DESCRIPTION as DESCRIPT3_13_, partyentit15_.ID as ID14_, case when [partyentit15__1_].ID is not null then 1 when [partyentit15__2_].ID is not null then 2 when partyentit15_.ID is not null then 0 end as clazz_14_, partyentit15_.EMAIL_ADDRESS as EMAI2_177_14_, [partyentit15__1_].TITLE as TITLE178_14_, [partyentit15__1_].SALUTATION as SALU3_178_14_, [partyentit15__1_].FIRST_NAME as FIRS4_178_14_, [partyentit15__1_].MIDDLE_NAME as MIDD5_178_14_, [partyentit15__1_].LAST_NAME as LAST6_178_14_, [partyentit15__2_].ORG_NAME as ORG_2_179_14_, [partyentit15__2_].ABBREVIATION as ABBR3_179_14_, [partyentit15__2_].HOMEPAGE_URL as HOME4_179_14_, [partyentit15__2_].GROUP_PREFIX as GROU5_179_14_, partyentit16_.ID as ID15_, case when [partyentit16__1_].ID is not null then 1 when [partyentit16__2_].ID is not null then 2 when partyentit16_.ID is not null then 0 end as clazz_15_, partyentit16_.EMAIL_ADDRESS as EMAI2_177_15_, [partyentit16__1_].TITLE as TITLE178_15_, [partyentit16__1_].SALUTATION as SALU3_178_15_, [partyentit16__1_].FIRST_NAME as FIRS4_178_15_, [partyentit16__1_].MIDDLE_NAME as MIDD5_178_15_, [partyentit16__1_].LAST_NAME as LAST6_178_15_, [partyentit16__2_].ORG_NAME as ORG_2_179_15_, [partyentit16__2_].ABBREVIATION as ABBR3_179_15_, [partyentit16__2_].HOMEPAGE_URL as HOME4_179_15_, [partyentit16__2_].GROUP_PREFIX as GROU5_179_15_, organizati17_.ID as ID16_, organizati17_.HOMEPAGE_URL as HOME4_179_16_, organizati17_.ORG_NAME as ORG_2_179_16_, organizati17_.GROUP_PREFIX as GROU5_179_16_, organizati17_.ABBREVIATION as ABBR3_179_16_, [organizati17__1_].EMAIL_ADDRESS as EMAI2_177_16_, partyentit18_.ID as ID17_, case when [partyentit18__1_].ID is not null then 1 when [partyentit18__2_].ID is not null then 2 when partyentit18_.ID is not null then 0 end as clazz_17_, partyentit18_.EMAIL_ADDRESS as EMAI2_177_17_, [partyentit18__1_].TITLE as TITLE178_17_, [partyentit18__1_].SALUTATION as SALU3_178_17_, [partyentit18__1_].FIRST_NAME as FIRS4_178_17_, [partyentit18__1_].MIDDLE_NAME as MIDD5_178_17_, [partyentit18__1_].LAST_NAME as LAST6_178_17_, [partyentit18__2_].ORG_NAME as ORG_2_179_17_, [partyentit18__2_].ABBREVIATION as ABBR3_179_17_, [partyentit18__2_].HOMEPAGE_URL as HOME4_179_17_, [partyentit18__2_].GROUP_PREFIX as GROU5_179_17_, jobtypeent19_.ID as ID18_, jobtypeent19_.NAME as NAME18_, jobtypeent19_.DESCRIPTION as DESCRIPT4_18_, jobtypeent19_.ABBREVIATION as ABBREVIA3_18_, partyentit20_.ID as ID19_, case when [partyentit20__1_].ID is not null then 1 when [partyentit20__2_].ID is not null then 2 when partyentit20_.ID is not null then 0 end as clazz_19_, partyentit20_.EMAIL_ADDRESS as EMAI2_177_19_, [partyentit20__1_].TITLE as TITLE178_19_, [partyentit20__1_].SALUTATION as SALU3_178_19_, [partyentit20__1_].FIRST_NAME as FIRS4_178_19_, [partyentit20__1_].MIDDLE_NAME as MIDD5_178_19_, [partyentit20__1_].LAST_NAME as LAST6_178_19_, [partyentit20__2_].ORG_NAME as ORG_2_179_19_, [partyentit20__2_].ABBREVIATION as ABBR3_179_19_, [partyentit20__2_].HOMEPAGE_URL as HOME4_179_19_, [partyentit20__2_].GROUP_PREFIX as GROU5_179_19_, priorityty21_.ID as ID20_, priorityty21_.NAME as NAME20_, priorityty21_.DESCRIPTION as DESCRIPT3_20_, contractty22_.ID as ID21_, contractty22_.DOMAIN_TYPE as DOMAIN_T5_21_, contractty22_.NAME as NAME21_, contractty22_.DESCRIPTION as DESCRIPT4_21_, contractty22_.ABBREVIATION as ABBREVIA3_21_, personenti23_.ID as ID22_, personenti23_.TITLE as TITLE178_22_, personenti23_.FIRST_NAME as FIRS4_178_22_, personenti23_.MIDDLE_NAME as MIDD5_178_22_, personenti23_.SALUTATION as SALU3_178_22_, personenti23_.LAST_NAME as LAST6_178_22_, [personenti23__1_].EMAIL_ADDRESS as EMAI2_177_22_ FROM ASCAT_SAMPLE this inner join SAMPLE [this_1_] on this.SAMPLE_FK=[this_1_].ID left outer join ASCAT_PLANT plantentit1_ on this.PLANT_FK=plantentit1_.ID left outer join ASCAT_GRADE gradeentit2_ on this.GRADE_FK=gradeentit2_.ID left outer join ASCAT_CAST_LINE castlineen3_ on this.CAST_LINE_FK=castlineen3_.ID left outer join ASCAT_SAMPLE_LOCATION sampleloca4_ on this.SAMPLE_LOCATION_FK=sampleloca4_.ID left outer join ASCAT_GRADE_TYPE gradetypee5_ on this.GRADE_TYPE_FK=gradetypee5_.ID left outer join SAMPLE_TYPE sampletype6_ on [this_1_].TYPE_FK=sampletype6_.ID left outer join CONTRACT contracten7_ on [this_1_].ORIGIN_FK=contracten7_.ID left outer join IDENTIFICATION identifica8_ on contracten7_.CLIENT_CONTRACT_NAME_FK=identifica8_.ID left outer join IDENTITY_SCHEME identitysc9_ on identifica8_.PARENT_FK=identitysc9_.ID left outer join PARTY partyentit10_ on identitysc9_.OWNER_FK=partyentit10_.ID left outer join PERSON [partyentit10__1_] on partyentit10_.ID=[partyentit10__1_].ID left outer join ORGANIZATION [partyentit10__2_] on partyentit10_.ID=[partyentit10__2_].ID left outer join STATUS statusenti11_ on contracten7_.STATUS_FK=statusenti11_.ID left outer join STATUS_TYPE statustype12_ on statusenti11_.TYPE_FK=statustype12_.ID left outer join ACCOUNT accountent13_ on contracten7_.ACCOUNT_FK=accountent13_.ID left outer join ACCOUNT_TYPE accounttyp14_ on accountent13_.TYPE_FK=accounttyp14_.ID left outer join PARTY partyentit15_ on accountent13_.DEFAULT_BILL_TO_FK=partyentit15_.ID left outer join PERSON [partyentit15__1_] on partyentit15_.ID=[partyentit15__1_].ID left outer join ORGANIZATION [partyentit15__2_] on partyentit15_.ID=[partyentit15__2_].ID left outer join PARTY partyentit16_ on accountent13_.CLIENT_FK=partyentit16_.ID left outer join PERSON [partyentit16__1_] on partyentit16_.ID=[partyentit16__1_].ID left outer join ORGANIZATION [partyentit16__2_] on partyentit16_.ID=[partyentit16__2_].ID left outer join ORGANIZATION organizati17_ on contracten7_.SERVICE_PROVIDER_FK=organizati17_.ID left outer join PARTY [organizati17__1_] on organizati17_.ID=[organizati17__1_].ID left outer join PARTY partyentit18_ on contracten7_.LOGGED_BY_FK=partyentit18_.ID left outer join PERSON [partyentit18__1_] on partyentit18_.ID=[partyentit18__1_].ID left outer join ORGANIZATION [partyentit18__2_] on partyentit18_.ID=[partyentit18__2_].ID left outer join JOB_TYPE jobtypeent19_ on contracten7_.JOB_TYPE_FK=jobtypeent19_.ID left outer join PARTY partyentit20_ on contracten7_.BILL_TO_FK=partyentit20_.ID left outer join PERSON [partyentit20__1_] on partyentit20_.ID=[partyentit20__1_].ID left outer join ORGANIZATION [partyentit20__2_] on partyentit20_.ID=[partyentit20__2_].ID left outer join PRIORITY_TYPE priorityty21_ on contracten7_.TURN_AROUND_TIME_FK=priorityty21_.ID left outer join CONTRACT_TYPE contractty22_ on contracten7_.TYPE_FK=contractty22_.ID left outer join PERSON personenti23_ on [this_1_].LOGGED_BY_FK=personenti23_.ID left outer join PARTY [personenti23__1_] on personenti23_.ID=[personenti23__1_].ID WHERE 1=1


I'm using NHibernate 1.0.2 with .Net 1.1


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.