Sunil Kumar Gupta

Ranch Hand
+ Follow
since Aug 26, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sunil Kumar Gupta

Will take it normal, because sometimes i also forget my friends birthday, why not they
10 years ago

Originally posted by Akhilesh Trivedi:


Oh, atleast you have....



11 years ago

Originally posted by marc weber:

Well, now it's raining here, so I need to change my answers to 1,552 and 3 respectively. I'll keep you posted.



I have very little brain.
11 years ago

Originally posted by Nitin Nigam:
How can a rancher tell how many of us speak while sleeping?
At best, a rancher can tell about herself/himself only



Let everyone reply and i will count
11 years ago
How many of you speak while sleeping?
11 years ago
It's too low now on 12K, How much i am loosing
11 years ago

Originally posted by Raghunandan Mamidala:
i woundn't care... its part of life



11 years ago
If you get to know you are dying next day.

Don't worry, I am happy from my life, just asking.
11 years ago

Originally posted by Jaikiran Pai:


Somewhere in your xml's i guess you have configured hibernate.cache.provider_class to use EhCache. I believe that's the reason why the second level cache is enabled. Remove that property from the xml and see if its works.



Hi Jaikiran, Thanks for replying.

I have checked my files, but i have not provided EhCache anywhere and the log i shared was coming when i don't use the below line

<property name="hibernate.cache.use_second_level_cache">false</property>

if i use this line, It shows that second level cache is disabled, yet i receive the old data only. I will check the link you shared with me.

Thanks.
Thanks g wildin for nice reply. Unfortunately, I have tried Session.flush and Session.clear but not getting the latest result.

Originally posted by g wildin:
Allow me to guess (disclaimer: I just took a hibernate class, but have no experience with it...). Maybe you are getting the detached object - that is why it is the old data. I think you can use if(session.contains(obj)) { session.evict(obj); } to remove it. Hope this helps.



This evict function will go where in my code given below.

try{ session = getSessionFactory().openSession(); System.out.println("PlayList: Session created"); Criteria crit = session.createCriteria(PlaylistBaseDataBean.class);crit.add(Expression.eq("id", id));List<PlaylistBaseDataBean> list = crit.list(); }catch(Exception e){ System.err.println("Exception occured in setPlaylist "+ e); } finally { session.close(); }

I am not using get or load.
I am just updating the value of any field in database. Say title changed from Hello to Hello123. I am pasting my code and log here.





and my log says, when client hit the webservice-

Automatic flush during beforeCompletion(): disabled
- Automatic session close at end of transaction: disabled
- Cache provider: org.hibernate.cache.EhCacheProvider
- Second-level cache: disabled
- Optimize cache for minimal puts: disabled
- Structured second-level cache entries: disabled
- Query cache: disabled
- Echoing all SQL to stdout
- Statistics: disabled
- Deleted entity synthetic identifier rollback: disabled

Gettting old data only. Till i restart the tomcat server or creates multiple SessionFacrories. This is strange, also According to documentation of Hibernate, Second level cache is disabled by default. But if i don't add the below line
<property name="hibernate.cache.use_second_level_cache">false</property>

I can see in my log

- Second-level cache: enabled

It means it is enabling second level cache by default.

[ edited to use code tags - Paul Sturrock ]
[ June 26, 2008: Message edited by: Paul Sturrock ]

Originally posted by Paul Sturrock:
Do you use a query cache?



No, I don't as you can see also in my file

<property name="hibernate.cache.use_query_cache">false</property>

I did everything to fix this issue. But
My code of getting data is -

Criteria crit = session.createCriteria(PlaylistBaseDataBean.class);
crit.add(Expression.eq("id", playlist.getId()));
List<PlaylistBaseDataBean> list = crit.list();


PlaylistBaseDataBean playlistBaseDataBean = (PlaylistBaseDataBean)list.get(0);

PlaylistBaseDataBean maps to a table in database.