-->
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: Subselect using filters causes positional parameter error
PostPosted: Mon Feb 21, 2005 2:09 pm 
Beginner
Beginner

Joined: Sat Jan 22, 2005 9:11 am
Posts: 35
Location: London
Dialect: PostgreSQL
Version: H3b4

We have filtering working nicely (great feature guys!!) but have just noticed a problem with subselects.

Below is a simple HQL query involving one class, one parameter and a subselect. The class is called "BaseDeal" and has a filter applied.

Code:
select bd from BaseDeal bd
where bd.product.id = :id
and bd.grossPrice =
( select min(bd2.grossPrice) from BaseDeal bd2 where bd2.product.id = bd.product.id )


The query fails since the filter seems to apply the filter parameter (which is a timestamp) in the productId position (which is an integer).

The generated SQL:
Code:
from BaseDeal basedeal0_
where ? >= basedeal0_.effFrom and ? < basedeal0_.effTo
and ((basedeal0_.productId=? ))

The query fails using either positional or named parameters.


If you just remove the parameter and add it by String concatenation the query works fine.

The generated SQL:
Code:
from BaseDeal basedeal1_
where ? >= basedeal1_.effFrom and ? < basedeal1_.effTo
and ((basedeal1_.productId=basedeal0_.productId )))))


The mapping file:

Code:
<class  name="BaseDeal"  table="BaseDeal">
  ...
    <filter name="effectiveDateFilter" condition=":asOfDate &gt;= effFrom and :asOfDate &lt; effTo "/>
</class>

<filter-def name="effectiveDateFilter">
    <filter-param name="asOfDate" type="timestamp"/>
</filter-def>



Is this a known "feature" with subselects for filtered classes or have I missed a FAQ entry somewhere? Perhaps this is not supported yet...

Thanks,
Ben


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 6:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please submit a runnable test case to JIRA, thanks.


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.