-->
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.  [ 3 posts ] 
Author Message
 Post subject: Too much info in generated sql!?
PostPosted: Tue Feb 17, 2004 7:10 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 7:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well the SQL generation just won't care about selecting some columns twice. Is that a problem for you?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 7:29 am 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
gloeglm wrote:
Well the SQL generation just won't care about selecting some columns twice. Is that a problem for you?


No problem.
In more complicated queries it could have some impact I think.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.