You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Gurkan Erdogdu <gu...@yahoo.com> on 2007/09/17 12:43:39 UTC

Flush Mode

Hi;

When I change User status in method1 using flush, it does not sync with the database. It still looks the same status value in other method. 

public void method1(){
EntityManager m;
EntityTransaction t;

m.setFLushMode(AUTO);
t = m.gettransaction();
t.begin;
Query q = some query to get User

User user = q.getResultLsit(0);
user.setState('T');

m.flush(); //Actually write sql update to the console but not synch with database
t.commit();

m.close;

runNewQuery();
}

Then in runNewQueryMethod just select user with new status but seems status not changed

 
EntityManager m;
Query q = some quety

User user = get user

but user status not changed.

If I look console it prints, update sql to the database while flushing, but not update to the database.

What is the problem guys?


       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC

Re: Flush Mode

Posted by Patrick Linskey <pl...@gmail.com>.
Can you post the actual code plus your persistence.xml file please?

-Patrick

On 9/17/07, Gurkan Erdogdu <gu...@yahoo.com> wrote:
> Hi;
>
> When I change User status in method1 using flush, it does not sync with the database. It still looks the same status value in other method.
>
> public void method1(){
> EntityManager m;
> EntityTransaction t;
>
> m.setFLushMode(AUTO);
> t = m.gettransaction();
> t.begin;
> Query q = some query to get User
>
> User user = q.getResultLsit(0);
> user.setState('T');
>
> m.flush(); //Actually write sql update to the console but not synch with database
> t.commit();
>
> m.close;
>
> runNewQuery();
> }
>
> Then in runNewQueryMethod just select user with new status but seems status not changed
>
>
> EntityManager m;
> Query q = some quety
>
> User user = get user
>
> but user status not changed.
>
> If I look console it prints, update sql to the database while flushing, but not update to the database.
>
> What is the problem guys?
>
>
>
> ____________________________________________________________________________________
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
> http://mobile.yahoo.com/go?refer=1GNXIC
>


-- 
Patrick Linskey
202 669 5907