-->
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: [Solved] Criteria does not return correct result
PostPosted: Fri Oct 29, 2010 2:00 pm 
Beginner
Beginner

Joined: Sat Oct 03, 2009 1:51 pm
Posts: 26
Hello!
I have this Criteria with conjunction:
Code:
public List<House> busca(House house, BigDecimal valueMin, BigDecimal valueMax) {      
      Criteria crit = session.createCriteria(House.class)
      .createAlias("address", "a");
      Criterion val = Restrictions.between("value", valueMin, valueMax);
      Criterion room = Restrictions.eq("room", house.getRoom());
      Criterion dist = Restrictions.ilike("a.district", house.getAddress().getDistrict(), MatchMode.ANYWHERE);
      Criterion city = Restrictions.ilike("a.city", house.getAdreess().getCity(), MatchMode.ANYWHERE);
      Criterion stat = Restrictions.ilike("a.state", house.getAddress().getState(), MatchMode.ANYWHERE);
      Conjunction conjunction = Restrictions.conjunction();
      if (house.getRoom() != null && !house.getRoom().equals(null))
         conjunction.add(room);
      if (house.getAddress().getDistrict() != null && !house.getAddress().getDistrict().isEmpty())
         conjunction.add(dist);      
      if (house.getAdreess().getCity() != null && !
house.getAdreess().getCity().isEmpty));
         conjunction.add(city);
      if (house.getAddress().getState() != null && !house.getAddress().getState().isEmpty()));
         conjunction.add(stat);
      if (valueMin != null && valueMax != null)
         conjunction.add(val);
      crit.add(conjunction);
      return crit.list();
   }   

The problem is that the house registered is not returning with arguments city "Rio de Janeiro" and state "RJ".
Stacktrace is correct:
Code:
15:58:15,876 DEBUG [OgnlParametersProvider] Applying house.address.city with [Rio de Janeiro   ]
15:58:15,877 DEBUG [OgnlParametersProvider] Applying house.address.state with [RJ]

Can anyone help?


Last edited by Guevara on Sat Oct 30, 2010 10:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Criteria does not return correct result
PostPosted: Sat Oct 30, 2010 10:43 am 
Beginner
Beginner

Joined: Sat Oct 03, 2009 1:51 pm
Posts: 26
Was a BUG in version 3.5.1-final, I downloaded the version 3.6.0-final and went back to work!


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.