gavin wrote:
Show the SQL.
NOTE: in the generated SQL code there will appear columns that don't exist in the posted mapping files. I took them out on purpose to simplify the reading.
Here's the generated SQL code by Hibernate:
Code:
Hibernate: 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__, versaodocu1_.documento_fk as document2___ from documento documento0_ inner join versao_documento versaodocu1_ on documento0_.id=versaodocu1_.documento_fk where (documento0_.id=? ) order by versaodocu1_.id asc
Hibernate: select documento0_.id as id3_, documento0_.nome as nome3_, documento0_.descricao as descricao3_, documento0_.user_id as user_id3_, documento0_.dt_hr as dt_hr3_, documento0_.pasta_documento_fk as pasta_do6_3_, docproxver1_.documento_fk as document1_0_, docproxver1_.versao_actual as versao_a2_0_, docproxver1_.user_id as user_id0_, docproxver1_.dt_hr as dt_hr0_, pastasdocu2_.id as id1_, pastasdocu2_.nome as nome1_, pastasdocu2_.descricao as descricao1_, pastasdocu2_.user_id as user_id1_, pastasdocu2_.dt_hr as dt_hr1_, pastasdocu2_.pasta_documento_fk as pasta_do6_1_, pastasdocu3_.id as id2_, pastasdocu3_.nome as nome2_, pastasdocu3_.descricao as descricao2_, pastasdocu3_.user_id as user_id2_, pastasdocu3_.dt_hr as dt_hr2_, pastasdocu3_.pasta_documento_fk as pasta_do6_2_ from documento documento0_ left outer join doc_prox_versao docproxver1_ on documento0_.id=docproxver1_.documento_fk left outer join pastas_documento pastasdocu2_ on documento0_.pasta_documento_fk=pastasdocu2_.id left outer join pastas_documento pastasdocu3_ on pastasdocu2_.pasta_documento_fk=pastasdocu3_.id where documento0_.id=?
Can't I order a collection for every returned
Documento?