Hi all, I still got his problem and can't seem to resolve it so I'll try again to see if anyone has any tips. set up is like this I've got a web service that can fetch large files from either ftp or http, when a file is fetched with one of these protocols, a new thread is started and downloads the file. Before the thread is started a new entry in the database is entered, after the download is complete we fetch the db entry and update the entry to say where the file was stored and size and set state to Finished. This works fine in a "stand alone" mode. But when we have an application that asks for the status(say every 2 sec ), by fetching the database entry and looking to see if that state of the db entry is finished, the update of the database entry never happens. The thread that should update the db entry has it's own EntityManager. The bethod that fetches the dn entry does not use a transaction, just entitymanger instance.
Does anyone have any tips on how to resolve this?? cheers, Håkon 2010/1/15 Håkon Sagehaug <[email protected]> > Hi > > Will adding a version and locking properties to the entities help with this > matter? > > cheers, Håkon > > 2010/1/13 Håkon Sagehaug <[email protected]> > > Hi Simone, >> >> The update does not raise any exceptions. I have no version on the entity, >> and not configured locking. I read alittle about locking, does it also apply >> outside a transaction, the update operations is in a transactions but the >> read is not. >> >> cheers, Håkon >> >> 2010/1/12 Simone Gianni <[email protected]> >> >> Hi Håkon, >>> is the update of the entity on the database raising any exception? Or it >>> silently refuses updating the database? >>> >>> Are you using a version field for optimistic locking? >>> >>> Simone >>> >>> >>> Håkon Sagehaug wrote: >>> >>>> Hi all, >>>> >>>> I've got a problem I'm not sure how to solve. The problems is as >>>> follows. >>>> We got a web service that can grab files from a ftp or http site, we use >>>> openjpa to store metadate about the resource, like name, when inserted >>>> etc. >>>> After this we write this information to the db and a new thread is >>>> started >>>> to download the file, after this is finished the db entry is retrieved >>>> and >>>> updated, with a status message, saying that the download was complete. >>>> >>>> We then have a client the after it sends a request, will poll the >>>> service >>>> using a operation called getResource(id), to see if the state is the to >>>> finished. The problem we see is that when the client issue a getResource >>>> we >>>> can't update the entry in the database. The file is downloaded, but the >>>> information in db isn't updated. If we issue the request getresource >>>> after a >>>> delay(2sec), on the client side everything works fine. >>>> >>>> Is there some synchonization needed, the web services used the same >>>> EntityManagerFactoryFactory but each method has it's own EntityManager >>>> object, also the thread downloaded the file. >>>> >>>> Have anyone experienced this? >>>> >>>> cheers, Håkon >>>> >>>> >>>> >>> >>> >>> -- >>> Simone Gianni CEO Semeru s.r.l. Apache Committer >>> http://www.simonegianni.it/ >>> >>> >> >> >> >> > > -- Håkon Sagehaug, Scientific Programmer Parallab, Bergen Center for Computational Science(BCCS) Uni BCCS/Uni Research [email protected], phone +47 55584125
