-->
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.  [ 2 posts ] 
Author Message
 Post subject: Indexed Collections and parameter binding
PostPosted: Mon Aug 01, 2005 3:43 am 
Newbie

Joined: Mon Aug 01, 2005 3:37 am
Posts: 2
Hi all.
Does anyone know why in a query with a indexed collection causes a bad order parameter binding?

This is my example:

Named query:

Code:
select a
  from Actividad a, DefinicionActividad da
where a.definicionActividad = da
          and a.proceso = :idProceso
          and (da.atributos[:nombre] = :dato)


Code used to execute it with Hibernate 3.0.5:

Code:
Query queryObject = session.getNamedQuery(queryName);
queryObject.setParameter("idProceso", 3);
queryObject.setParameter("nombre", "PREGUNTA");
queryObject.setParameter("dato", "TIPO_ACTIVIDAD");


SQL query generated in MySQL:

Code:
select ...
from ...
where definicion1_.id=atributos2_.idDefinicionActividad
   and atributos2_.[b]nombre[/b] = '3'
   and actividad0_.definicionActividad=definicion1_.id
   and actividad0_.[b]idProceso[/b] = 'PREGUNTA'
   and atributos2_.[b]dato[/b] = 'TIPO_ACTIVIDAD'


Its seems that the "da.atributos[:nombre]" part is correctly translated as "atributos2_.nombre = ?" but placed first in the query, and wrong binded with the first parameter passed: "3" and ignoring the name of that parameter.
It happens too without using named parameters and using "da.atributos[?]" instead.

It happen with the ASTQueryTranslatorFactory and the old ClassicQueryTranslatorFactory (pre 3.0) parser, but the last one can not handle indexed collections in subqueries either (http://opensource.atlassian.com/projects/hibernate/browse/HHH-310).

Thanks in advance.

_________________
Nicolas Cornaglia
http://nikofactory.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 5:22 am 
Newbie

Joined: Mon Aug 01, 2005 3:37 am
Posts: 2
I found this as a bug: http://opensource.atlassian.com/project ... owse/HB-13

_________________
Nicolas Cornaglia
http://nikofactory.blogspot.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.