Re: Transaction question
Hi, Leandro Augusto de Almeida wrote: Hi Armin, I put the broker.beginTransaction() and broker.commitTransaction() only for test, because I was getting the same exception on broker.close() and now on broker.commit() (because commit closes the con...). Using the old datasource (not XA) this works fine. The bean that calls this method is configured bm-tx. do you use this code in a EJB or only in a servlet? do you set ConnectionFactoryManagedImpl in OJB.properties file as ConnectionFactory and JTATransactionManagerClass for use within Websphere? regards, Armin PersistenceBroker broker = null; try { if (log.isInfoEnabled()) { log.info("Iniciando DAO - " + this.className + ".findAllParametro()"); } broker = PersistenceBrokerFactory.defaultPersistenceBroker(); broker.beginTransaction(); QueryByCriteria query = new QueryByCriteria(ParametroVO.class, null); Vector parametros = (Vector) broker.getCollectionByQuery(query); if (log.isInfoEnabled()) { log.info("Finalizando DAO - " + this.className + ".findAllParametro()"); } broker.commitTransaction(); return parametros; } catch (PBFactoryException pbfe) { ResourceException re = new ResourceException("Erro ao procurar parâmetros: erro ao buscar o PersistenceBroker.", pbfe); . finally {broker.close();} --- Mensagem Original --- Hi Leandro, could you post a snip of the source code? regards, Armin Leandro Augusto de Almeida wrote: Hi Armin, I was using a DataSource (in Websphere) from the Jdbc Provider oracle.jdbc.pool.OracleConnectionPoolDataSource and using the PB-tx-demarcation (broker.beginTransaction().). When I changed the datasource to oracle.jdbc.xa.client.OracleXADataSource the application shows this exception when commit is called : 46563 ERROR accesslayer.ConnectionFactoryAbstractImpl - Closing connection failed com.ibm.ejs.cm.exception.WorkRolledbackException: Outstanding work on this connection which was not comitted or rolledback by the user has been rolledback. at org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(DelegatingPersistenceBroker.java:145) at br.com.equifax.dataqa.procir.persistencia.dao.OjbParametroDAO.findAllParametro(OjbParametroDAO.java:258) Do you know what I am doing wrong ? --- Mensagem Original --- Hi Leandro, Leandro Augusto de Almeida wrote: Is it possible to use PB-tx-demarcation on a session bean with bm-tx and getting a connection from a DataSource from my AppServer? Is it right? What is the correct connection factory to use? Or I must use the user (JTA) tx-demarcation with the ConnectionFactoryManagedImpl and choose between cm-tx or bm-tx? yep, in managed environments you have always to use JTA (except you don't want to use distributed tx at all and set tx-demarcation to 'none'). All settings described here http://db.apache.org/ojb/deployment.html#Deployment%20in%20EJB%20based%20applications regards, Armin Thanks, Leandro. - 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] - 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]
Re: Re: Transaction question
Hi Armin, I put the broker.beginTransaction() and broker.commitTransaction() only for test, because I was getting the same exception on broker.close() and now on broker.commit() (because commit closes the con...). Using the old datasource (not XA) this works fine. The bean that calls this method is configured bm-tx. PersistenceBroker broker = null; try { if (log.isInfoEnabled()) { log.info("Iniciando DAO - " + this.className + ".findAllParametro()"); } broker = PersistenceBrokerFactory.defaultPersistenceBroker(); broker.beginTransaction(); QueryByCriteria query = new QueryByCriteria(ParametroVO.class, null); Vector parametros = (Vector) broker.getCollectionByQuery(query); if (log.isInfoEnabled()) { log.info("Finalizando DAO - " + this.className + ".findAllParametro()"); } broker.commitTransaction(); return parametros; } catch (PBFactoryException pbfe) { ResourceException re = new ResourceException("Erro ao procurar parâmetros: erro ao buscar o PersistenceBroker.", pbfe); . finally {broker.close();} --- Mensagem Original --- > Hi Leandro, > > could you post a snip of the source code? > > regards, > Armin > > Leandro Augusto de Almeida wrote: > > > Hi Armin, > > > > I was using a DataSource (in Websphere) from > the Jdbc Provider > oracle.jdbc.pool.OracleConnectionPoolDataSource > and using the PB-tx-demarcation > (broker.beginTransaction().). When I changed > the datasource to > oracle.jdbc.xa.client.OracleXADataSource the > application shows this exception when commit is > called : > > > > 46563 ERROR > accesslayer.ConnectionFactoryAbstractImpl - > Closing connection failed > > > com.ibm.ejs.cm.exception.WorkRolledbackException: > Outstanding work on this connection which was > not comitted or rolledback by the user has been > rolledback. > > at > org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(DelegatingPersistenceBroker.java:145) > > > at > br.com.equifax.dataqa.procir.persistencia.dao.OjbParametroDAO.findAllParametro(OjbParametroDAO.java:258) > > > > > Do you know what I am doing wrong ? > > > > --- Mensagem Original --- > > > >>Hi Leandro, > >> > >>Leandro Augusto de Almeida wrote: > >> > >> > >>>Is it possible to use PB-tx-demarcation on a > > >> > >>session bean with bm-tx and getting a > connection > >>from a DataSource from my AppServer? Is it > >>right? What is the correct connection factory > to > >>use? > >> > >>>Or I must use the user (JTA) tx-demarcation > >> > >>with the ConnectionFactoryManagedImpl and > choose > >>between cm-tx or bm-tx? > >> > >>yep, in managed environments you have always > to > >>use JTA (except you > >>don't want to use distributed tx at all and > set > >>tx-demarcation to > >>'none'). All settings described here > >> > >> > > >>http://db.apache.org/ojb/deployment.html#Deployment%20in%20EJB%20based%20applications > > >> > >> > >>regards, > >>Armin > >> > >> > >>>Thanks, > >>> > >>>Leandro. > >>> > >>> > >> > > >>- > > >> > >> > >>>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] > > > > > > > > > - > > 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]
Re: Transaction question
Hi Leandro, could you post a snip of the source code? regards, Armin Leandro Augusto de Almeida wrote: Hi Armin, I was using a DataSource (in Websphere) from the Jdbc Provider oracle.jdbc.pool.OracleConnectionPoolDataSource and using the PB-tx-demarcation (broker.beginTransaction().). When I changed the datasource to oracle.jdbc.xa.client.OracleXADataSource the application shows this exception when commit is called : 46563 ERROR accesslayer.ConnectionFactoryAbstractImpl - Closing connection failed com.ibm.ejs.cm.exception.WorkRolledbackException: Outstanding work on this connection which was not comitted or rolledback by the user has been rolledback. at org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(DelegatingPersistenceBroker.java:145) at br.com.equifax.dataqa.procir.persistencia.dao.OjbParametroDAO.findAllParametro(OjbParametroDAO.java:258) Do you know what I am doing wrong ? --- Mensagem Original --- Hi Leandro, Leandro Augusto de Almeida wrote: Is it possible to use PB-tx-demarcation on a session bean with bm-tx and getting a connection from a DataSource from my AppServer? Is it right? What is the correct connection factory to use? Or I must use the user (JTA) tx-demarcation with the ConnectionFactoryManagedImpl and choose between cm-tx or bm-tx? yep, in managed environments you have always to use JTA (except you don't want to use distributed tx at all and set tx-demarcation to 'none'). All settings described here http://db.apache.org/ojb/deployment.html#Deployment%20in%20EJB%20based%20applications regards, Armin Thanks, Leandro. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: Transaction question
Hi Armin, I was using a DataSource (in Websphere) from the Jdbc Provider oracle.jdbc.pool.OracleConnectionPoolDataSource and using the PB-tx-demarcation (broker.beginTransaction().). When I changed the datasource to oracle.jdbc.xa.client.OracleXADataSource the application shows this exception when commit is called : 46563 ERROR accesslayer.ConnectionFactoryAbstractImpl - Closing connection failed com.ibm.ejs.cm.exception.WorkRolledbackException: Outstanding work on this connection which was not comitted or rolledback by the user has been rolledback. at org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(DelegatingPersistenceBroker.java:145) at br.com.equifax.dataqa.procir.persistencia.dao.OjbParametroDAO.findAllParametro(OjbParametroDAO.java:258) Do you know what I am doing wrong ? --- Mensagem Original --- > Hi Leandro, > > Leandro Augusto de Almeida wrote: > > > Is it possible to use PB-tx-demarcation on a > session bean with bm-tx and getting a connection > from a DataSource from my AppServer? Is it > right? What is the correct connection factory to > use? > > Or I must use the user (JTA) tx-demarcation > with the ConnectionFactoryManagedImpl and choose > between cm-tx or bm-tx? > > > > yep, in managed environments you have always to > use JTA (except you > don't want to use distributed tx at all and set > tx-demarcation to > 'none'). All settings described here > > > http://db.apache.org/ojb/deployment.html#Deployment%20in%20EJB%20based%20applications > > > regards, > Armin > > > Thanks, > > > > Leandro. > > > > > - > > > 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]
Re: Transaction question
Hi Leandro, Leandro Augusto de Almeida wrote: Is it possible to use PB-tx-demarcation on a session bean with bm-tx and getting a connection from a DataSource from my AppServer? Is it right? What is the correct connection factory to use? Or I must use the user (JTA) tx-demarcation with the ConnectionFactoryManagedImpl and choose between cm-tx or bm-tx? yep, in managed environments you have always to use JTA (except you don't want to use distributed tx at all and set tx-demarcation to 'none'). All settings described here http://db.apache.org/ojb/deployment.html#Deployment%20in%20EJB%20based%20applications regards, Armin Thanks, Leandro. - 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]
Transaction question
Is it possible to use PB-tx-demarcation on a session bean with bm-tx and getting a connection from a DataSource from my AppServer? Is it right? What is the correct connection factory to use? Or I must use the user (JTA) tx-demarcation with the ConnectionFactoryManagedImpl and choose between cm-tx or bm-tx? Thanks, Leandro. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Transaction Question
Hi, Ziv Yankowitz wrote: Folks, We are using ODMG local transaction is there any way to set timeout on the transaction? Sorry no. ODMG-api does not support timeout of tx. But you can config the object lock time (LockTimeout) in OJB.properties. regards, Armin thanks. - 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]
Transaction Question
Folks, We are using ODMG local transaction is there any way to set timeout on the transaction? thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Transaction Question.
Hi, There can only be one ODMG transaction open per thread. Thanks, Rob :) > -Original Message- > From: Ziv Yankowitz [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 10 February 2004 5:39 a.m. > To: OJB (E-mail) > Subject: Transaction Question. > > > Folks, > > Is Nested Transaction supported within ODMG? > > assuming we have the following : > > within the same Thread. > > Transaction1 start > Transaction2 start > Transaction2 finish > Transaction1 finish. > > Thanks. > > > - > 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]
Transaction Question.
Folks, Is Nested Transaction supported within ODMG? assuming we have the following : within the same Thread. Transaction1 start Transaction2 start Transaction2 finish Transaction1 finish. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: broker usage in odmg transaction question
Hi Jair Jr., Jair da Silva Ferreira Júnior wrote: Hi, I am using ojb1.0_rc4, ODMG api with OJB queries and mysql4. When running OJB queries using the broker, is it necessary to begin, commit or abort the broker transaction? Which one should I use? Example 1 or 2? hmm, if you start an odmg-transaction and obtain a PB instance via PersistenceBroker broker = ((HasBroker) transaction).getBroker(); I would recommend not to do any PB-transaction action. So 2) should be ok, because you only do read-operations. regards, Armin 1) ... PersistenceBroker broker = ((HasBroker) transaction).getBroker(); broker.beginTransaction(); Iterator it=broker.getIteratorByQuery(q); //do something with the iterator broker.commitTransaction(); ... 2) PersistenceBroker broker = ((HasBroker) transaction).getBroker(); Iterator it=broker.getIteratorByQuery(q); //do something with the iterator Thanks, Jair Jr - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
broker usage in odmg transaction question
Hi, I am using ojb1.0_rc4, ODMG api with OJB queries and mysql4. When running OJB queries using the broker, is it necessary to begin, commit or abort the broker transaction? Which one should I use? Example 1 or 2? 1) ... PersistenceBroker broker = ((HasBroker) transaction).getBroker(); broker.beginTransaction(); Iterator it=broker.getIteratorByQuery(q); //do something with the iterator broker.commitTransaction(); ... 2) PersistenceBroker broker = ((HasBroker) transaction).getBroker(); Iterator it=broker.getIteratorByQuery(q); //do something with the iterator Thanks, Jair Jr