You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Da...@ext.cec.eu.int on 2005/07/01 16:58:33 UTC
Problem with ObjectCacheTwoLevelImpl
Hi,
I have a very weird problem with the ObjectCacheTwoLevelImpl cache.
I'm using two environments:
Jboss 4.0.1 for development and BEA WebLogic 8.1sp4 for production.
The class descriptors are the following:
<class-descriptor class="Action" table="ACTION" isolation-level =
"read-uncommitted" >
<field-descriptor id="1" name="id" column="ACTION_ID"
jdbc-type="INTEGER" primarykey="true"/>
<field-descriptor id="2" name="actionTypeId" column="ACTION_TP_ID"
jdbc-type="INTEGER" primarykey="false"/>
<field-descriptor id="5" name="title" column="TITLE"
jdbc-type="VARCHAR" primarykey="false"/>
<reference-descriptor name="envelope" class-ref="Envelope"
proxy="true"
auto-retrieve="true" auto-update="link"
auto-delete="false" >
<foreignkey field-ref="id"/>
</reference-descriptor>
</class-descriptor>
<class-descriptor class="Envelope" table="ENVELOPE" isolation-level =
"read-uncommitted">
<field-descriptor id="1" name="actionId" column="action_id"
jdbc-type="INTEGER" primarykey="true"/>
<field-descriptor id="3" name="totalAmount" column="total_amnt"
jdbc-type="DECIMAL" primarykey="false" />
<field-descriptor id="4" name="startDate" column="start_dt"
jdbc-type="TIMESTAMP" primarykey="false"/>
<field-descriptor id="5" name="endDate" column="end_dt"
jdbc-type="TIMESTAMP" primarykey="false"/>
</class-descriptor>
All the classes are cached at jdbc-connection-descriptor level using :
<object-cache
class="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl">
<attribute attribute-name="cacheExcludes" attribute-value=""/>
<attribute attribute-name="applicationCache"
attribute-value="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl"/>
<attribute attribute-name="copyStrategy"
attribute-value="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$CopyStr
ategyImpl"/>
<attribute attribute-name="timeout" attribute-value="9000"/>
<attribute attribute-name="autoSync" attribute-value="true"/>
<attribute attribute-name="cachingKeyType" attribute-value="0"/>
<attribute attribute-name="useSoftReferences"
attribute-value="true"/>
</object-cache>
The code is something like that (we are in a managed environment and this
method is in a session bean):
public void save() throws Exception {
PBKey key = new PBKey(dbName);
PersistenceBroker pb =
PersistenceBrokerFactory.createPersistenceBroker(key);
Action action = null;
Envelope envelope = null;
action = mainObject.getAction();
envelope = action.getEnvelope();
envelope.setTotalAmount(getAmount());
envelope.setenvelopeType(envelopetype);
envelope.setFootNote(getFootnote());
envdetmng.insert(envelope);
pb.close();
}
Under Jboss no problem.
Under WebLogic, when we call mainObject.getAction().getEnvelope(), we get
the "old" envelope, like the envelope has not been updated.
After a clearCache(), everything is fine.
It looks like the db is updated, but not the cache.
Is it a transactional issue ?
Is it a bug in the cache ? (in this case why in Weblogic and not in Jboss)
Any idea ????
David WIESZTAL.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Problem with ObjectCacheTwoLevelImpl
Posted by Armin Waibel <ar...@apache.org>.
Hi David,
I don't think that this is a bug in the cache implementation, because it
works with JBoss. It could be a transactional issue. Any problems when
using using
JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WeblogicTransactionManagerFactory
You can try to enable log-level 'info' for
org.apache.ojb.broker.transaction.tm.WeblogicTransactionManagerFactory
to get info on OJB startup.
Additionally enable 'debug' log-level for
org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl
to check the call of javax.transaction.Sysnchronization#afterCompletion
This method was called by the appServer TransactionManager and OJB use
this method to synchronize the cache (see class
PersistenceBrokerFactorySyncImpl line 281).
regards,
Armin
David.WIESZTAL@ext.cec.eu.int wrote:
> Hi,
>
>
> I have a very weird problem with the ObjectCacheTwoLevelImpl cache.
> I'm using two environments:
> Jboss 4.0.1 for development and BEA WebLogic 8.1sp4 for production.
>
> The class descriptors are the following:
> <class-descriptor class="Action" table="ACTION" isolation-level =
> "read-uncommitted" >
> <field-descriptor id="1" name="id" column="ACTION_ID"
> jdbc-type="INTEGER" primarykey="true"/>
> <field-descriptor id="2" name="actionTypeId" column="ACTION_TP_ID"
> jdbc-type="INTEGER" primarykey="false"/>
> <field-descriptor id="5" name="title" column="TITLE"
> jdbc-type="VARCHAR" primarykey="false"/>
> <reference-descriptor name="envelope" class-ref="Envelope"
> proxy="true"
> auto-retrieve="true" auto-update="link"
> auto-delete="false" >
> <foreignkey field-ref="id"/>
> </reference-descriptor>
> </class-descriptor>
> <class-descriptor class="Envelope" table="ENVELOPE" isolation-level =
> "read-uncommitted">
> <field-descriptor id="1" name="actionId" column="action_id"
> jdbc-type="INTEGER" primarykey="true"/>
> <field-descriptor id="3" name="totalAmount" column="total_amnt"
> jdbc-type="DECIMAL" primarykey="false" />
> <field-descriptor id="4" name="startDate" column="start_dt"
> jdbc-type="TIMESTAMP" primarykey="false"/>
> <field-descriptor id="5" name="endDate" column="end_dt"
> jdbc-type="TIMESTAMP" primarykey="false"/>
> </class-descriptor>
>
> All the classes are cached at jdbc-connection-descriptor level using :
> <object-cache
> class="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl">
> <attribute attribute-name="cacheExcludes" attribute-value=""/>
> <attribute attribute-name="applicationCache"
> attribute-value="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl"/>
> <attribute attribute-name="copyStrategy"
> attribute-value="org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl$CopyStr
> ategyImpl"/>
> <attribute attribute-name="timeout" attribute-value="9000"/>
> <attribute attribute-name="autoSync" attribute-value="true"/>
> <attribute attribute-name="cachingKeyType" attribute-value="0"/>
> <attribute attribute-name="useSoftReferences"
> attribute-value="true"/>
> </object-cache>
>
> The code is something like that (we are in a managed environment and this
> method is in a session bean):
>
> public void save() throws Exception {
> PBKey key = new PBKey(dbName);
> PersistenceBroker pb =
> PersistenceBrokerFactory.createPersistenceBroker(key);
>
> Action action = null;
> Envelope envelope = null;
>
> action = mainObject.getAction();
>
> envelope = action.getEnvelope();
> envelope.setTotalAmount(getAmount());
> envelope.setenvelopeType(envelopetype);
> envelope.setFootNote(getFootnote());
>
> envdetmng.insert(envelope);
>
> pb.close();
> }
>
> Under Jboss no problem.
> Under WebLogic, when we call mainObject.getAction().getEnvelope(), we get
> the "old" envelope, like the envelope has not been updated.
> After a clearCache(), everything is fine.
> It looks like the db is updated, but not the cache.
> Is it a transactional issue ?
> Is it a bug in the cache ? (in this case why in Weblogic and not in Jboss)
>
> Any idea ????
>
>
>
> David WIESZTAL.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org