I'm using Hibernate 2.1.1.
My mapping files were generated with Middlegen R3 and are at (no need posting again):
http://forum.hibernate.org/viewtopic.ph ... highlight=
---------
Code
---------
Code:
( ... )
session = sessionFactory.openSession();
List res = session.find("from vo.Documento d join fetch d.versaoDocumentos vd where d.id = ? order by vd.comp_id.id asc", documento_id, Hibernate.LONG);
( ... )
--------------------
Generated SQL
--------------------
Code:
select documento0_.id as id0_,
versaodocu1_.id as id1_,
versaodocu1_.documento_fk as document2_1_,
documento0_.nome as nome0_,
documento0_.descricao as descricao0_,
documento0_.user_id as user_id0_,
documento0_.dt_hr as dt_hr0_,
documento0_.pasta_documento_fk as pasta_do6_0_,
versaodocu1_.descricao as descricao1_,
versaodocu1_.user_submissao as user_sub4_1_,
versaodocu1_.data_submissao as data_sub5_1_,
versaodocu1_.aprovado as aprovado1_,
versaodocu1_.user_aprovacao as user_apr7_1_,
versaodocu1_.data_aprovacao as data_apr8_1_,
versaodocu1_.user_id as user_id1_,
versaodocu1_.dt_hr as dt_hr1_,
versaodocu1_.id as id__, (1)
versaodocu1_.documento_fk as document2___ (2)
from documento documento0_
inner join versao_documento versaodocu1_ on documento0_.id=versaodocu1_.documento_fk
where (documento0_.id=? )
order by versaodocu1_.id asc
What are (1) and (2) for!? There's already alias for them.
They're not used in the rest af the query.
NOTE: some properties that appear in the query don't show up in the mapping files. Did this to simply reading.