-->
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: Problem with query
PostPosted: Wed Feb 02, 2011 9:21 am 
Newbie

Joined: Wed Aug 18, 2010 6:43 am
Posts: 10
Hi All

I'm trying to run this Search query it works there are no errors but it does NOT pick up 'WHERE s.clientId = clientId' suppliers some how it ignores this part. why ? Where am I going wrong ???
I need some help please.
Code:
@NamedQuery(name = "Supplier.findBySupplierNameLike", query = "SELECT s FROM Supplier s WHERE s.clientId = clientId and lower(s.name) like lower(concat(:name, '%'))") })


Many thanks
Zed


Top
 Profile  
 
 Post subject: Re: Problem with query
PostPosted: Wed Feb 02, 2011 12:48 pm 
Newbie

Joined: Wed Aug 18, 2010 6:43 am
Posts: 10
Its good to solve your own problems some times. I manage to do it after banging my head on Laptop few times.
Code:
@NamedQuery(name = "Supplier.findBySupplierNameLike", query = "SELECT s FROM Supplier s WHERE s.clientId = :clientId and lower(s.name) like lower(concat(:name, '%'))") })

@Override
   public List<Supplier> getSuppliersBySupplierNameLike(Integer clientId, String supplierName) {
      em.getTransaction().begin();
      @SuppressWarnings("unchecked")
      List<Supplier> sups = em.createNamedQuery("Supplier.findBySupplierNameLike")
         .setParameter("clientId", clientId).setParameter("name",supplierName).getResultList();
      em.getTransaction().commit();
      return sups;
   }


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.