users@glassfish.java.net

Re: I have a tabled named "items"

From: Dominik Dorn <dominik.dorn_at_gmail.com>
Date: Wed, 3 Nov 2010 16:12:04 +0100

This is a caching issue in the EntityManager. You're using Jersey, right?

For me, giving eclipselink a hint to refresh the query every time, worked.

    q = em.createQuery(jpaQuery);
    q.setHint("eclipselink.refresh", "true");
    q.setParameter("documentId", d.getId());
    List<Page> pages = q.getResultList();

but its probably not the optimal solution.



On Wed, Nov 3, 2010 at 3:45 PM, <noreply_at_java.net> wrote:
>  I have a tabled named "items" in a db. columns are "itemId", "BillId",
> "itemDescription" and "quantity". ItemId is an auto incrementing attribute.
>
> Im using entityManagerFactory. Once I call the webservice I retrieve all
> raws
> which has same billID.
>
> EX: Im sendin 2 as BillID. there are 3 rows which billId=2.
>
>
>
> row 1. itemId=2,BillId=2,description="mobile 4n",Quantity=3
>
> row 2. itemId=5,BillId=2,description="Umbrella",Quantity=2
>
> row 3. itemId=7,BillId=2,description="Microphone",Quantity=5
>
> I update 2nd row Umbrella quantity using web service. After I update
> Umbrquantity =6
>
>
>
> now database values are
>
> row 1. itemId=2,BillId=2,description="mobile 4n",Quantity=3
>
> *row 2. itemId=5,BillId=2,description="Umbrella",Quantity=6*
>               <<<<<<<<<
>
> row 3. itemId=7,BillId=2,description="Microphone",Quantity=5
>
>
>
> Now again I send billId=2 and request for the above updated rows(I send the
> request through web service).
>
> In my expected result unbrella quantity shoud be 6. But im retrieving the
> previouse value(umbrella quantiy=2).
>
> BUt if I after restart glassfish and send billId=2 then i retrieve expecting
> result.(umbrella quantiy=6).
>
>
> --
>
> [Message sent by forum member 'xcyclops40']
>
> View Post: http://forums.java.net/node/711073
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>



-- 
Dominik Dorn
http://dominikdorn.com
http://twitter.com/domdorn
Tausche Deine Lernunterlagen auf http://www.studyguru.eu !