Hi Armin,

I really appreciate your response. The connection descriptor is as
follows:

        <jdbc-connection-descriptor 
                jcd-alias="OJBDb" 
                default-connection="true" 
                platform="Db2" 
                jdbc-level="1.0" 
                jndi-datasource-name="jdbc/ojbDataSource"
                username="someUserName" 
                password="somePassWord" 
                batch-mode="false" 
                useAutoCommit="0" 
                ignoreAutoCommitExceptions="false">
                <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl">
                    <attribute attribute-name="grabSize"
attribute-value="1"></attribute>
                </sequence-manager>
        </jdbc-connection-descriptor>

The OJB.properties file has the following settings:

# repository file settings
repositoryFile=repository.xml
useSerializedRepository=false
serializedRepositoryPath=.

# PersistenceBrokerFactory / PersistenceBroker
PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl
PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl

# PersistenceBroker pool
maxActive=100
maxIdle=-1
maxWait=2000
timeBetweenEvictionRunsMillis=-1
minEvictableIdleTimeMillis=1000000
whenExhaustedAction=2

# ConnectionFactory / Default ConnectionPool
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl

# ConnectionManager
ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerImpl

# SqlGenerator
SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl

# IndirectionHandler
IndirectionHandlerClass=org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl

# ListProxy
ListProxyClass=org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl

# SetProxy
SetProxyClass=org.apache.ojb.broker.core.proxy.SetProxyDefaultImpl

# CollectionProxy
CollectionProxyClass=org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl

# StatementManager
StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager

# StatementsForClass
StatementsForClassClass=org.apache.ojb.broker.accesslayer.StatementsForClassImpl

# JdbcAccess
JdbcAccessClass=org.apache.ojb.broker.accesslayer.JdbcAccessImpl

# Object cache
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
descriptorBasedCaches=false

# Locking
LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl
LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl
LockTimeout=60000
ImplicitLocking=true
LockServletUrl=http://127.0.0.1:8080/ojb-lockserver
LockAssociations=WRITE

# OQL / SQL settings
OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
SqlInLimit=200

# ODMG settings
ImplementationClass=org.apache.ojb.odmg.ImplementationDefaultImpl
OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager
DListClass=org.apache.ojb.odmg.collections.DListImpl_2
DArrayClass=org.apache.ojb.odmg.collections.DListImpl_2
DMapClass=org.apache.ojb.odmg.collections.DMapImpl
DBagClass=org.apache.ojb.odmg.collections.DBagImpl
DSetClass=org.apache.ojb.odmg.collections.DSetImpl

# Meta data / mapping settings
PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImpl

# Transaction Management and assocation
JTATransactionManagerClass=org.apache.ojb.broker.transaction.tm.WebSphereTransactionManagerFactory

# Logging
LoggerClass=org.apache.ojb.broker.util.logging.PoorMansLoggerImpl
LoggerConfigFile=log4j.properties
DEFAULT.LogLevel=WARN
org.apache.ojb.broker.core.PersistenceBrokerImpl.LogLevel=WARN
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.LogLevel=WARN
org.apache.ojb.broker.metadata.RepositoryXmlHandler.LogLevel=WARN
org.apache.ojb.broker.metadata.ConnectionDescriptorXmlHandler.LogLevel=WARN
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.LogLevel=WARN
org.apache.ojb.broker.accesslayer.RsIterator.LogLevel=WARN
org.apache.ojb.broker.accesslayer.StatementsForClassImpl.LogLevel=WARN
org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.LogLevel=WARN
org.apache.ojb.broker.metadata.RepositoryPersistor.LogLevel=WARN
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.LogLevel=WARN
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.LogLevel=WARN
org.apache.ojb.broker.core.proxy.IndirectionHandler.LogLevel=WARN
ODMG.LogLevel=DEBUG
JDO.LogLevel=DEBUG
performance.LogLevel=INFO
soda.LogLevel=WARN
ConfigurableFactory.LogLevel=WARN

Is there something I should change in OJB.properties? I am using ojb1.0.1.
Any help is appreciated. Thanks. 

Regards,
-Vamsi

--- Armin Waibel <[EMAIL PROTECTED]> wrote:

> Hi Vamsi,
> 
> Vamsi Atluri wrote:
> > Hello all,
> > 
> > I am having problem with getting my transactions rolled back. I have
> read
> > the documentation a bit about OTM but I am not clear about what I
> should
> > do in my situation.
> > 
> > I am using OJB1.0.1 for DB2 and running on WAS 5.0 (currently testing
> on
> > WSAD 5.1.2). My data save code looks something like this:
> >
> 
> You have two possibilities:
> 
> 1. Using OJB in non-managed environments (without delegating transaction
> 
> handling to JTA - provided by WSAD). Use of the default 
> PersistenceBrokerFactoryClass (OJB.properties).
> 
> 2. In managed environments by synchronize OJB within JTA-transactions. 
> Use of a specific PersistenceBrokerFactoryClass (see OJB.properties and
>
http://db.apache.org/ojb/docu/guides/deployment.html#Deployment+in+managed+environment+%28e.g.+EJB+based%29).
> 
> 
> > PersistenceBroker broker =
> > PersistenceBrokerFactory.defaultPersistenceBroker();
> > 
> > try {
> >     broker.beginTransaction();
> > 
> >     broker.store(objA); //step 1
> >     broker.store(objB); //step 2
> >     broker.store(objC); //step 3
> >     broker.deleteByQuery(someQuery); //step 4
> >     broker.store(objD); //step 5
> > 
> >     broker.commitTransaction();
> > } catch(PersistenceBrokerException pbe) {
> >     if(null != broker) {
> >         broker.abortTransaction();
> >     }
> > } catch(Exception e) {
> >     if(null != broker) {
> >         broker.abortTransaction();
> >     }
> > } finally {
> >     if(null != broker) {
> >         broker.close();
> >     }
> > }
> > 
> > It so happens that if there is any Exception during any of the steps,
> the
> > previous steps are not being rolled back. Is it possible that I can
> get
> > the ConnectionManager from the broker and use it for managing my
> > transactions? The document says that OJB provides only DB level
> > transactions but not object level transactions. What does that this
> > exactly mean?
> 
> The PB-api (currently) only offer "DB level transactions"
> http://db.apache.org/ojb/docu/guides/pb-guide.html#Transactions
> 
> This mean that the PB-api does not use a "unit-of work" concept when 
> starting a tx. All object manipulation is immediately written to the DB 
> and rollback when commit fail.
> The ODMG-api use a kind of "unit-of-work" and write all modified objects
> 
> to DB as recently as tx.commit is called.
> 
> 
> > Do I "have" to implement OTM (which would be a huge
> > undertaking given the amount of tables we store)?
> 
> no
> 
> Your first example will work with the default settings shipped with OJB.
> Assume you are using wrong configuration settings. Could you post 
> OJB.properties and jdbc-connection-descriptor settings?
> 
> 
> You have to take care when using
>  >     broker.deleteByQuery(someQuery); //step 4
> because this call does bypass cache synchronization.
>
http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html#deleteByQuery(org.apache.ojb.broker.query.Query)
> 
> regards,
> Armin
> 
>   Or can I do something
> > like this:
> > 
> > PersistenceBroker broker =
> > PersistenceBrokerFactory.defaultPersistenceBroker();
> > java.sql.Connection conn = null;
> > 
> > try {
> >     ConnectionManagerIF connectionManager =
> > broker.serviceConnectionManager();
> >     conn = connectionManager.getConnection();
> >     conn.setAutoCommit(false);
> > 
> >     broker.store(objA); //step 1
> >     broker.store(objB); //step 2
> >     broker.store(objC); //step 3
> >     broker.deleteByQuery(someQuery); //step 4
> >     broker.store(objD); //step 5
> > 
> >     conn.commit();
> > } catch(PersistenceBrokerException pbe) {
> >     if(null != conn) {
> >         conn.rollback();
> >     }
> > } catch(Exception e) {
> >     if(null != conn) {
> >         conn.rollback();
> >     }
> > } finally {
> >     if(null != broker) {
> >         broker.close();
> >     }
> > }
> > 
> > Any help is greatly appreciated in this matter. Thank you.
> > 
> > Regards,
> > -Vamsi
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to