Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.0.0
We noticed that hql query like :
[code]
"select
partner.PartnerId,partner.PartnerName,partner_loc.DsppCountry.CountryName,
partner_loc.DsppCountry.CountryCode,
detail.DsppPartnerTaxonomy.Name
from
DsppPartner partner
join partner.SetOfDsppPartnerManagement_1 partner_mgmt
join partner.DsppPartnerLocation partner_loc
join partner_mgmt.DsppPartnerTaxonomy_1.SetOfDsppPartnerTaxonomyDetail detail
where
(upper(partner.PartnerName) like upper('%next%') or
upper(partner_mgmt.PreviousPartnerName) like upper('%next%')) and
(partner_mgmt.MarkedForDeletion <> 1) and
detail.DsppLanguage.LangId = 1
order by partner.PartnerName"
executes properly with the
Hiberrnate Version 3.0.0, but does not work with the
Hibernate Version 3.1.3
In the above HQL Query, note the bold and italic semantics i.e.
detail.DsppPartnerTaxonomy.Name which is having an issue with
Hibernate Version 3.1.3. If we remove this statement from the query, it parses and converts the above HQL into SQL successfully, however there is no issue with above HQL using Hiberrnate Version 3.0.0
Here "
DsppPartnerTaxonomy" and "
DsppPartnerTaxonomyDetail" have parent/child bidirectional relationship respectively.
Full stack trace of any exception that occurs: NONE
Name and version of the database you are using:MS SQL server 2000 <br>
JDBC Driver used : Microsoft JDBC Type4 driver (com.microsoft.jdbc.sqlserver.SQLServerDriver)
The generated SQL (show_sql=true):
select dspppartne0_.partner_id as col_0_0_, dspppartne0_.partner_name as col_1_0_, dsppcountr5_.country_name as col_2_0_, dsppcountr5_.country_code as col_3_0_, dspppartne6_.name as col_4_0_ from dspp_partner dspppartne0_ inner join dspp_partner_management setofdsppp1_ on dspppartne0_.partner_id=setofdsppp1_.partner_id inner join dspp_partner_location dspppartne2_ on dspppartne0_.partner_location_id=dspppartne2_.location_id inner join dspp_partner_taxonomy dspppartne3_ on setofdsppp1_.membership_status=dspppartne3_.taxonomy_id inner join dspp_partner_taxonomy_detail setofdsppp4_ on dspppartne3_.taxonomy_id=setofdsppp4_.taxonomy_id, dspp_country dsppcountr5_, dspp_partner_taxonomy dspppartne6_ where dspppartne2_.country=dsppcountr5_.country_id and setofdsppp4_.taxonomy_id=dspppartne6_.taxonomy_id and (((upper(dspppartne0_.partner_name)like upper('%next%'))or(upper(setofdsppp1_.previous_partner_name)like upper('%next%')))and((setofdsppp1_.marked_for_deletion<>1 ))and(setofdsppp4_.lang_id=1 )) order by dspppartne0_.partner_name
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Hibernate version:3.1.3
Full stack trace of any exception that occurs:
EXCEPTION CLASS : class org.hibernate.exception.GenericJDBCException
EXCEPTION MESSAGE : could not execute query using scroll
EXCEPTION CAUSE : java.sql.SQLException: The column prefix 'dspppartne0_' does not match with a table name or alias name used in the query.
<br>
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'dspppartne0_' does not match with a table name or alias name used in the query.
Name and version of the database you are using:MS SQL server 2000 <br>
JDBC Driver used : Microsoft JDBC Type4 driver (com.microsoft.jdbc.sqlserver.SQLServerDriver)
The generated SQL (show_sql=true):
select dspppartne0_.partner_id as col_0_0_, dspppartne0_.partner_name as col_1_0_, dsppcountr5_.country_name as col_2_0_, dsppcountr5_.country_code as col_3_0_, dspppartne6_.name as col_4_0_ from dspp_partner dspppartne0_ inner join dspp_partner_management setofdsppp1_ on dspppartne0_.partner_id=setofdsppp1_.partner_id inner join dspp_partner_location dspppartne2_ on dspppartne0_.partner_location_id=dspppartne2_.location_id inner join dspp_partner_taxonomy dspppartne3_ on setofdsppp1_.membership_status=dspppartne3_.taxonomy_id inner join dspp_partner_taxonomy_detail setofdsppp4_ on dspppartne3_.taxonomy_id=setofdsppp4_.taxonomy_id, dspp_country dsppcountr5_, dspp_partner_taxonomy dspppartne6_ where dspppartne2_.country=dsppcountr5_.country_id and setofdsppp4_.taxonomy_id=dspppartne6_.taxonomy_id and (((upper(dspppartne0_.partner_name)like upper('%next%'))or(upper(setofdsppp1_.previous_partner_name)like upper('%next%')))and((setofdsppp1_.marked_for_deletion<>1 ))and(setofdsppp4_.lang_id=1 )) order by dspppartne0_.partner_name
Please let me know if there is any change in HQL to SQL conversion semantics across Hibernate Version 3.0.0 and Hibernate Version 3.1.3
It would be of great help, if anybody can find out some time for this issue, since its very urgent and blocking issue in our project. We want to use the latest hibernate version and take the final decision.
Thanks & Regards,
Devesh