ejb@glassfish.java.net

RE: query returning null data

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Mon, 25 Jan 2010 14:58:24 +0000

Chris

 

I've tried either way and it was not working. I am using

Jsf webclients. I will send further information of steps

I am applying so you could understand my problem.

 

Thanks

 

eve
 
> Date: Mon, 25 Jan 2010 09:01:12 -0500
> From: christopher.delahunt_at_oracle.com
> To: persistence_at_glassfish.dev.java.net
> CC: ejb_at_glassfish.dev.java.net
> Subject: Re: FW: query returning null data
>
> Hello Eve,
>
> This example is wrong and should get an NPE on customers.getCusid(). I
> think you mixed up customer and customers in the parameter and the
> return variable.
>
> Best Regards,
> Chris
>
> Eve Pokua wrote:
> >
> >
> > ------------------------------------------------------------------------
> > 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
> > <http://clk.atdmt.com/UKM/go/195013117/direct/01/>
> > ------------------------------------------------------------------------
> > Not got a Hotmail account? Sign-up now - Free
> > <http://clk.atdmt.com/UKM/go/197222280/direct/01/>
                                               
_________________________________________________________________
Send us your Hotmail stories and be featured in our newsletter
http://clk.atdmt.com/UKM/go/195013117/direct/01/