All right Armin, sorry... I can't undestand your previous email, but now I', studing more... But tell me, ODMG-api is more simple to use with managed enviroment and stateless session beans?
Thanks, Fernando Bernardino ----- Original Message ----- From: "Armin Waibel" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Wednesday, November 17, 2004 2:55 PM Subject: Re: Error with ConnectionManagerImpl... > Hi Fernando, > > the exception when using PersistenceBrokerFactorySyncImpl is correct: > > java.lang.UnsupportedOperationException: In managed environments only > JTA transaction demarcation allowed > at > org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl$PersistenceBroke rSyncImpl.abortTransaction(Unknown > Source) > at > org.apache.ojb.broker.core.DelegatingPersistenceBroker.abortTransaction(Unkn own > Source) > at br.com.ptcom.webField.dao.BaseDAO.insert(BaseDAO.java:41) > > As I said in my previous mail, in managed environments only JTA-tx > demarcation is allowed (declare container managed tx in your deployment > descriptor or lookup via JNDI a UserTransaction in your bean). > So, if you use PB-tx demarcation an exception will be thrown. > > Here is an example for using PB-api within a session bean and container > managed transaction > http://cvs.apache.org/viewcvs.cgi/db-ojb/src/ejb/org/apache/ojb/ejb/pb/PBSes sionBean.java?rev=1.5.2.1&view=markup > > Note that you first have to provide a JTA-tx (when using container > managed tx all session bean method calls have a running tx, when using > UserTransaction first lookup the tx) and then obtain a PB instance from > the PBF. > > regards, > Armin > > > Fernando Gomes Bernardino wrote: > > Hi again, > > > > Armin, I'm using a new properties, based on the ojb guides.You can see in: > > http://fgbernardino.vo6.net/ojb.properties_1711.htm > > > > My enviroment is JBoss 3.2.5, I'm using JNDI and DataSource. I'm using PB-Api, this way: > > > > public BaseDAO(){ > > try{ > > broker = PersistenceBrokerFactoryFactory.instance().defaultPersistenceBroker(); > > }catch(Exception e){ > > e.printStackTrace(); > > } > > } > > > > public void insert(Object object) throws DAOException{ > > try { > > broker.beginTransaction(); > > broker.store(object); > > broker.commitTransaction(); > > } catch (Exception e) { > > try { > > broker.abortTransaction(); > > } catch (TransactionNotInProgressException e1) { > > throw new DAOException(e); > > } > > throw new DAOException(e); > > } finally { > > broker.close(); > > } > > } > > > > > > If I use the > > "PersistenceBrokerFactoryClass= > > org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl" , > > I can store the object but an error is showed: > > http://fgbernardino.vo6.net/error_DefaultImpl_today.htm > > > > But, if I change to > > "PersistenceBrokerFactoryClass= > > org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl" , > > I can't store the object, an error is showed when I do > > "broker.beginTransaction()" : > > http://fgbernardino.vo6.net/error_syncImpl.htm > > > > I'm looking to .properties but I can't find nothing... > > Thanks a lot for your time and sorry about the links, but if I send an large email, it's return to me... > > > > Thanks, > > > > Fernando Bernardino > > > > > > --------------------------------- > > Yahoo! Acesso Gr�tis - Internet r�pida e gr�tis. Instale o discador agora! > > --------------------------------------------------------------------- > 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]
