-->
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 HQL and SQL translation problem
PostPosted: Fri Nov 11, 2005 7:29 pm 
Newbie

Joined: Fri Nov 11, 2005 7:16 pm
Posts: 2
Hi,

Below is my HQL and translated SQL.

[select man from Manifest man
join man.manifestPorts as m_port
join man.voyage as voyage1
join man.voyage as voyage2
where voyage1.svcLoop =?
and voyage1.vesselCertificate = ?
and voyage1.voyId = ?
and voyage1.voyDir = ?
and man.callNum =?
and man.customsPort= ?
and voyage2.svcLoop =?
and voyage2.vesselCertificate = ?
and voyage2.voyId = ?
and voyage2.voyDir = ?
and m_port.voyage = voyage2.voyId]

SQL:
[select
manifest0_.MNFST_ID as MNFST1_21_,
manifest0_.DSCH_VOY_ID as DSCH2_21_,
manifest0_.DSCH_PORT_CD as DSCH3_21_,
manifest0_.CALL_NUM as CALL4_21_,
manifest0_.AAO_NUM as AAO5_21_,
manifest0_.UVRN_NUM as UVRN6_21_,
manifest0_.LST_UPD_USR as LST24_21_,
manifest0_.LST_UPD_TS as LST25_21_
from
CanadaDb.dbo.MANIFEST manifest0_
inner join
CanadaDb.dbo.MANIFEST_PORT manifestpo1_
on manifest0_.MNFST_ID=manifestpo1_.MNFST_ID
inner join
CanadaDb.dbo.VOYAGE voyage2_
on manifest0_.DSCH_VOY_ID=voyage2_.VOY_ID
where
voyage2_.SVC_LOOP=?
and voyage2_.VSL_CD=?
and voyage2_.VOY_ID=?
and voyage2_.VOY_DIR=?
and manifest0_.CALL_NUM=?
and manifest0_.DSCH_PORT_CD=?
and voyage2_.SVC_LOOP=?
and voyage2_.VSL_CD=?
and voyage2_.VOY_ID=?
and voyage2_.VOY_DIR=?
and manifestpo1_.LOAD_VOY_ID=voyage2_.VOY_ID]

But i want my sql to be translated like this.

[select
manifest0_.MNFST_ID as MNFST1_21_,
manifest0_.DSCH_VOY_ID as DSCH2_21_,
manifest0_.DSCH_PORT_CD as DSCH3_21_,
manifest0_.CALL_NUM as CALL4_21_,
manifest0_.AAO_NUM as AAO5_21_,
manifest0_.UVRN_NUM as UVRN6_21_,
manifest0_.LST_UPD_USR as LST24_21_,
manifest0_.LST_UPD_TS as LST25_21_
from
CanadaDb.dbo.MANIFEST manifest0_
inner join
CanadaDb.dbo.MANIFEST_PORT manifestpo1_
on manifest0_.MNFST_ID=manifestpo1_.MNFST_ID
inner join
CanadaDb.dbo.VOYAGE voyage1
on manifest0_.DSCH_VOY_ID=voyage2_.VOY_ID
inner join
CanadaDb.dbo.VOYAGE voyage2_
on manifest0_.DSCH_VOY_ID=voyage3_.VOY_ID
where
voyage1_.SVC_LOOP=?
and voyage1_.VSL_CD=?
and voyage1_.VOY_ID=?
and voyage1_.VOY_DIR=?
and manifest0_.CALL_NUM=?
and manifest0_.DSCH_PORT_CD=?
and voyage2_.SVC_LOOP=?
and voyage2_.VSL_CD=?
and voyage2_.VOY_ID=?
and voyage2_.VOY_DIR=?
and manifestpo1_.LOAD_VOY_ID=voyage2_.VOY_ID]

Please advise me on this, can i achieve this or not. If it is possible how can i change my HQL query. Or even in the SQL query its not showing the second reference of voyage, my HQL query still works the way i want?[/code]


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.