What we do here is opening the transaction just when we need to do a
business operation. The procedure is sth like this: First an action
calls the store service to update/insert/select/delete you open a
transaction, then do the work and finally close the transaction when the
work is done. I don't see the need to leave a transaction open and
stored in the session.
Hope it helps.
On Sun, 2004-07-04 at 15:08, [EMAIL PROTECTED] wrote:
>
>
> Hello everybody,
>
> I am trying to implement a function with the ODMG API and Struts.
>
> The model is a 1:n relationship between objects of two types, let's say a
> class BankAccount that owns a collection of BankTransactions. In a first
> page the user chooses an account to manage, then the application shows a
> second page he inserts a Transaction.
>
> To do that, I open an ODMG transaction at the beginning end store it in the
> HTTP session. With this transaction I retrieve the BankAccount in the
> Struts Action corresponding to the first page and I store it also in the
> http session. In the second Struts action I create a new BankTransaction,
> add it to my BankAccount and try to do a checkpoint() with the stored
> transaction. This does not work every time.
>
> I get a "org.odmg.TransactionNotInProgressException: Calling method needed
> transaction, but no transaction found for current thread :-(". The whole
> stack trace is at the end of this mail.
>
> I looked a bit further and saw that LocalTxManager indexes the transactions
> in a hashmap by the Thread that registered them. Since I am in a servlet I
> have no warranty that two different http requests, as i have in my example,
> are managed by the same thread and this explains why sometimes it does not
> work (Actually, it works from time to time only because I am the only user
> of my developement server ;-)).
>
> I have serched the documentation and the users list, but did not find
> anything about this problem. Is there anywhere a parameter that I did not
> see right or is this a bug ?
>
> Thank you
>
> Stefano
>
>
>
>
> org.odmg.TransactionNotInProgressException: Calling method needed
> transaction, but no transaction found for current thread :-(
> at
> org.apache.ojb.odmg.LocalTxManager.getCurrentTransaction(LocalTxManager.java:50)
> at
> org.apache.ojb.odmg.locking.LockStrategyFactory.getIsolationLevel(LockStrategyFactory.java:83)
> at
> org.apache.ojb.odmg.locking.LockStrategyFactory.getStrategyFor(LockStrategyFactory.java:54)
> at
> org.apache.ojb.odmg.locking.LockManagerDefaultImpl.upgradeLock(LockManagerDefaultImpl.java:87)
> at org.apache.ojb.odmg.TransactionImpl.lock(TransactionImpl.java:254)
> at
> org.apache.ojb.odmg.ObjectEnvelopeTable.upgradeImplicitLocksAndCheckIfCommitIsNeeded(ObjectEnvelopeTable.java:260)
> at
> org.apache.ojb.odmg.ObjectEnvelopeTable.commit(ObjectEnvelopeTable.java:152)
> at
> org.apache.ojb.odmg.TransactionImpl.doCommitOnObjects(TransactionImpl.java:306)
> at
> org.apache.ojb.odmg.TransactionImpl.checkpoint(TransactionImpl.java:441)
> at
> ch.admin.ofit.framework.persistence.ojb.odmg.PersistenceManagerOjbOdmgImpl.storeState(PersistenceManagerOjbOdmgImpl.java:83)
> at
> ch.admin.formation.controler.creation.ControleurCreation.valideDecision(ControleurCreation.java:129)
> at
> ch.admin.formation.controler.creation.DecisionCreationEtat.transitionSuivant(DecisionCreationEtat.java:49)
> at
> ch.admin.formation.controler.creation.MachineEtatsCreation.transmetTransition(MachineEtatsCreation.java:35)
> at
> ch.admin.formation.struts.BusinessAction.perform(BusinessAction.java:39)
> at
> org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
> at java.lang.Thread.run(Thread.java:513)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Saludos,
Martin I. Levi
Centre Tecnol�gic de Transferenci�ncia de Calor
Universitat Polit�cnica de Catalunya
www.cttc.upc.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]