persistence@glassfish.java.net

FW: query returning null data

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Fri, 22 Jan 2010 21:23:27 +0000

 


From: gorgeous65_at_msn.com
To: users_at_glassfish.dev.java.net
Date: Fri, 22 Jan 2010 00:23:49 +0000
Subject: query returning null data



 
Hello everyone,
 
I'm trying to use the following query to return data but I'm
sure if I'm on the right track -
 
public Customerent custLogin(Customerent customer)throws ShoppingException{
          Customerent customers= null;
                  
            try{
                            Query qt
                                    = em.createQuery("select c from Customerent c where c.cusid=?");
                   qt.setParameter(1, customers.getCusid());
                   return (Customerent)qt.getSingleResult();
            }catch (Exception e) {
                            logger.error("There was an error getting the customer login details. exception: " + e);
                            return customer;
                             
           }
            
        }
 
I'm not getting the results I want.
 
Thanks
 
eve



Do you have a story that started on Hotmail? Tell us now
_________________________________________________________________
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/