Not able to fetch updated data using jdbc and oracle 10g
Whenever i m updating the data and fetching the same record after updating i m not able to get the fresh/new updated data , old record is fetched every time, but when i checked in database the record gets updated successfully , even if i fire the query two times after 10 seconds using Thread.sleep even then problem persist.
Please help me out!!!!!!!!
Implementation has been stucked up!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :(
# 1
Are you commiting your change. (i.e. are you calling conn.commit();)
# 2
HI !
i have commited
the thing is that when i refresh from my browser i get the new updated data, it is not the case of cache because data is not fetched from database.
i have checked the data by using print statements in my code ,it is showing the old data not updated one,
# 3
After you do the update your code has to re-SELECT the data and send that back to the view. How else can you see the updated values?
%
# 4
Well its ok
i m doing the same thing
please go thru the below code fragment:
code for Update :::
DataAccessBean1 partsHistoryDataAccessBean = new DataAccessBean1(context);
partsHistoryDataAccessBean.setData(data);
partsHistoryDataAccessBean.update();
After Updating i m forwading it to the other servlet
Calling select
DataAccessBean2 dataAccessBean2 = new DataAccessBean2(context);
dataAccessBean2.addCondition(condition);
ListData dataList = dataAccessBean2.select();
According to your assumption i should get the updated data on the other screen but
i m not getting ....:(((
# 5
> Well its ok
What is OK? Your stuff working now?
> i m doing the same thing
Apparently not.
> please go thru the below code fragment:
>
> code for Update :::
> DataAccessBean1 partsHistoryDataAccessBean = new
> DataAccessBean1(context);
> partsHistoryDataAccessBean.setData(data);
> partsHistoryDataAccessBean.update();
>
> After Updating i m forwading it to the other servlet
Forwarding what? Why do you need another servlet? Just do the query, put the new data into the response object, and return.
> According to your assumption i should get the updated
> data on the other screen but
Nope, you don't understand what I'm saying.
%
# 6
Shouldn't be doing any of this in a servlet anyway.
Move this code into a separate class that you can test without the servlet container.
%
# 7
Dear friend !
what will happen if i use the same servlet , i think there is no need for that , as updated data is not from db it is not the concern of having two different servlets , Isn't it?
# 8
i hav created the separate class and after updating the db i fired a query and i got the updated data
but why i m not getting the data if i m firing query in my web based module ... :(((