-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to clean cache(cache2)?
PostPosted: Sat Jan 03, 2009 6:21 am 
Newbie

Joined: Sat Jan 03, 2009 4:16 am
Posts: 1
Although I saw lots of questions related to my problem I couldn't get an appropriate answer.

I have a .xml file as following;
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Feb 7, 2007 10:55:48 AM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping default-lazy="true" package="com.myworks.db.bean">
<class name="offerStocks" table="STOCKS" >
.
.
.
<property name="codes" type="java.math.BigDecimal">
<column name="STOCK_CODE" precision="14" not-null="true" />
</property>
<property name="stockName" type="string" formula="(SELECT STOK_NAMES FROM DESCRIPT S WHERE S.ID)STOCK_CODE)"/>
</class>
</hibernate-mapping>

When I call a record from offerStocks I get the related stockName too.
By adding a record (.saveOrUpdate()) I see that it is updated to the database.After I call it again I see that the stockName=null.After refreshing the page, then I see the appropriate value of stockName.

Is it possible to clean the cache after saveOrUpdate()?

If its neccessary I can post the whole source code!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 03, 2009 4:14 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
gorenekli ,

How does the page acquire the data?
Are you using 2nd level cache, as the title of your post suggests?

_________________
Gonzalo Díaz


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2009 5:14 am 
Regular
Regular

Joined: Wed Oct 15, 2008 6:59 am
Posts: 103
Location: Chennai
Use evict() on Session & SessionFactory. also use flush() & clear() for session.

**) Use openSession() instead of getSession().

_________________
If u feel it will help you, don't forget to rate me....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.