From: George T. <geo...@fr...> - 2005-12-26 13:59:50
|
Hello, I am developing a TMAPI server using SOAP web services the server uses Hibernate and MySQL. When I create a new TopicMap, the save function inside the "org.tm4j.topicmap.hibernate.TopicMapFactoryImpl" finds that the transaction is closed, opens a new one and saves the changes in the database. the next time I open the TopicMap, again the transaction is closed, and the function does the same thing, and saves the changes. The third time? Something strange is happening here from the third time and after. the transaction found open, the change happens but not saved inside the database. I suppose because there is no commit() When I close the server and I start it again, all the changes without the commit() are gone! I didn't have this problem when I tried to do the same thing using RMI server and Hibernate (I am using SOAP now) There is more than a week now where I am puzled with this and any hint, idea, anything, would be highly appreciated could be a good idea to force closing the transaction, or commit? Thank you in advance. Cheers protected void save(PersistenceWrapper tmobject, String id) throws DuplicateObjectIDException { if (id == null) { id = m_idgen.getID(); } try { TopicMapObjectDataObject dataObject = ((TopicMapObjectDataObject) tmobject.m_dataObject); if (m_provider.isTransactionOpen()) { System.out.println ("transaction is open"); checkID(m_provider.getOpenTransaction(), id); dataObject.setObjectId(id); TopicMapDataObject tmdo = (TopicMapDataObject) PersistenceWrapper.load(m_provider.getOpenTransaction(),m_topicMap); dataObject.setTopicMap(tmdo); PersistenceWrapper.persist(m_provider.getOpenTransaction(), tmobject); } else { System.out.println ("transaction is closed"); ProviderTransaction txn = m_provider.openTransaction(); try { checkID(m_provider.getOpenTransaction(), id); dataObject.setObjectId(id); TopicMapDataObject tmdo = (TopicMapDataObject) PersistenceWrapper.load(txn,m_topicMap); dataObject.setTopicMap(tmdo); PersistenceWrapper.persist(txn, tmobject); txn.commit(); } catch (Exception ex) { txn.rollback(); throw ex; } } if (tmobject instanceof TopicImpl) { m_provider.registerTopic(tmobject.getPersistenceId(),(TopicImpl) tmobject); } } catch (DuplicateObjectIDException ex) { throw ex; } catch (Exception ex) { throw new TopicMapRuntimeException("Storage Exception.", ex); } } ____________________________________________________________________ http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου. http://www.freemail.gr - free email service for the Greek-speaking. |
From: Kal A. <ka...@te...> - 2005-12-27 16:04:03
|
Hi George, That sounds strange - the save code by itself should always be doing its work in its own transaction, if the provider has no open transaction, as = you can see in the code you copied in your message. I wonder if there is = some other call which is starting a transaction and failing to close it (it = might be in your code, or in the TM4J persistence layer). To track this down, perhaps you can insert logging statements in various places in your code = - especially at request start and end - to see if the provider has an open transaction or not. I'm guessing that you are holding the TopicMap = object between requests ? The work-around for this might be to wrap all of your operations for a single request in one or more transactions (i.e. use the = openTransaction() and commit() methods explicitly). Cheers, Kal > -----Original Message----- > From: tm4...@li... [mailto:tm4j-users- > ad...@li...] On Behalf Of George Tryfon > Sent: 26 December 2005 13:59 > To: tm4...@li... > Subject: [TM4J-users] Hibernate Transactions question >=20 > Hello, > I am developing a TMAPI server using SOAP web services > the server uses Hibernate and MySQL. >=20 > When I create a new TopicMap, the save function inside the > "org.tm4j.topicmap.hibernate.TopicMapFactoryImpl" > finds that the transaction is closed, opens a new one and saves the > changes > in the database. >=20 > the next time I open the TopicMap, again the transaction is closed, = and > the > function does the > same thing, and saves the changes. >=20 > The third time? > Something strange is happening here from the third time and after. > the transaction found open, the change happens but not saved inside = the > database. > I suppose because there is no commit() > When I close the server and I start it again, all the changes without = the > commit() are gone! > I didn't have this problem when I tried to do the same thing using RMI > server and Hibernate > (I am using SOAP now) >=20 > There is more than a week now where I am puzled with this and any = hint, > idea, anything, would be highly appreciated >=20 > could be a good idea to force closing the transaction, or commit? >=20 > Thank you in advance. > Cheers >=20 >=20 > protected void save(PersistenceWrapper tmobject, String id) throws > DuplicateObjectIDException > { > if (id =3D=3D null) > { > id =3D m_idgen.getID(); > } >=20 > try > { > TopicMapObjectDataObject dataObject =3D = ((TopicMapObjectDataObject) > tmobject.m_dataObject); >=20 > if (m_provider.isTransactionOpen()) > { > System.out.println ("transaction is open"); > checkID(m_provider.getOpenTransaction(), id); > dataObject.setObjectId(id); >=20 > TopicMapDataObject tmdo =3D (TopicMapDataObject) > PersistenceWrapper.load(m_provider.getOpenTransaction(),m_topicMap); > dataObject.setTopicMap(tmdo); > PersistenceWrapper.persist(m_provider.getOpenTransaction(), > tmobject); > } > else > { > System.out.println ("transaction is closed"); > ProviderTransaction txn =3D m_provider.openTransaction(); >=20 > try > { > checkID(m_provider.getOpenTransaction(), id); > dataObject.setObjectId(id); >=20 > TopicMapDataObject tmdo =3D (TopicMapDataObject) > PersistenceWrapper.load(txn,m_topicMap); > dataObject.setTopicMap(tmdo); > PersistenceWrapper.persist(txn, tmobject); > txn.commit(); > } > catch (Exception ex) > { > txn.rollback(); > throw ex; > } > } >=20 > if (tmobject instanceof TopicImpl) > { >=20 > m_provider.registerTopic(tmobject.getPersistenceId(),(TopicImpl) > tmobject); > } > } > catch (DuplicateObjectIDException ex) > { > throw ex; > } > catch (Exception ex) > { > throw new TopicMapRuntimeException("Storage Exception.", ex); > } > } >=20 >=20 > ____________________________________________________________________ > http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 = =E7=EB=E5=EA=F4=F1=EF=ED=E9=EA=EF=FD = =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5. > http://www.freemail.gr - free email service for the Greek-speaking. >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD = SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users >=20 |
From: George T. <geo...@fr...> - 2005-12-27 21:59:03
|
I found this for the Hibernate Transaction. The transaction remain open after I call a Tolog query (bypassing the TMAPI) public String[] getRemoteTologTmos (String tmName, String query, String= =20 colonName) throws RemoteException { try { TopicMap _tm =3D TMHelper.getDefault().getTopicMap(tmName); org.tm4j.topicmap.TopicMap tm =3D Wrapper.unwrap(_tm);=20 //_tm.getWrapped()); QueryEvaluator qe =3D QueryEvaluatorFactory.newQueryEvaluator (tm); //TODO: add rules here... //qe.addRule ("t($T) :- topic($T)."); org.tm4j.topicmap.TopicMapProvider provider =3D tm.getProvider (); ProviderTransaction providerTransaction =3D=20 provider.getOpenTransaction(); if (providerTransaction =3D=3D null) providerTransaction =3D provider.openTransaction(); System.out.println (query); //<> TologResultsSet rSet =3D qe.execute (query); System.out.println ("execution done."); //<> int colonIndex =3D -1; for (int c=3D0; c<rSet.getNumCols(); c++) { if (rSet.getVar(c).equals(colonName)) colonIndex =3D c; } Vector<String> v =3D new Vector<String> (); for (int i=3D0; i<rSet.getNumRows(); i++) { List list =3D rSet.getRow (i); org.tm4j.topicmap.TopicMapObject tmo =3D=20 (org.tm4j.topicmap.TopicMapObject)list.get (colonIndex); v.add (tmo.getID()); } return v.toArray(new String[0]); } catch (Exception ex) { throw new RemoteException (ex.getMessage(), ex); } } what is your suggestion in order to close the transaction? Cheers, George ----- Original Message -----=20 From: "Kal Ahmed" <ka...@te...> To: "'George Tryfon'" <geo...@fr...>;=20 <tm4...@li...> Sent: Tuesday, December 27, 2005 5:30 PM Subject: RE: [TM4J-users] Hibernate Transactions question Hi George, That sounds strange - the save code by itself should always be doing its work in its own transaction, if the provider has no open transaction, as = you can see in the code you copied in your message. I wonder if there is some other call which is starting a transaction and failing to close it (it mi= ght be in your code, or in the TM4J persistence layer). To track this down, perhaps you can insert logging statements in various places in your code = - especially at request start and end - to see if the provider has an open transaction or not. I'm guessing that you are holding the TopicMap object between requests ? The work-around for this might be to wrap all of your operations for a single request in one or more transactions (i.e. use the openTransaction(= ) and commit() methods explicitly). Cheers, Kal > -----Original Message----- > From: tm4...@li... [mailto:tm4j-users- > ad...@li...] On Behalf Of George Tryfon > Sent: 26 December 2005 13:59 > To: tm4...@li... > Subject: [TM4J-users] Hibernate Transactions question > > Hello, > I am developing a TMAPI server using SOAP web services > the server uses Hibernate and MySQL. > > When I create a new TopicMap, the save function inside the > "org.tm4j.topicmap.hibernate.TopicMapFactoryImpl" > finds that the transaction is closed, opens a new one and saves the > changes > in the database. > > the next time I open the TopicMap, again the transaction is closed, and > the > function does the > same thing, and saves the changes. > > The third time? > Something strange is happening here from the third time and after. > the transaction found open, the change happens but not saved inside the > database. > I suppose because there is no commit() > When I close the server and I start it again, all the changes without t= he > commit() are gone! > I didn't have this problem when I tried to do the same thing using RMI > server and Hibernate > (I am using SOAP now) > > There is more than a week now where I am puzled with this and any hint, > idea, anything, would be highly appreciated > > could be a good idea to force closing the transaction, or commit? > > Thank you in advance. > Cheers > > > protected void save(PersistenceWrapper tmobject, String id) throws > DuplicateObjectIDException > { > if (id =3D=3D null) > { > id =3D m_idgen.getID(); > } > > try > { > TopicMapObjectDataObject dataObject =3D ((TopicMapObjectDataObje= ct) > tmobject.m_dataObject); > > if (m_provider.isTransactionOpen()) > { > System.out.println ("transaction is open"); > checkID(m_provider.getOpenTransaction(), id); > dataObject.setObjectId(id); > > TopicMapDataObject tmdo =3D (TopicMapDataObject) > PersistenceWrapper.load(m_provider.getOpenTransaction(),m_topicMap); > dataObject.setTopicMap(tmdo); > PersistenceWrapper.persist(m_provider.getOpenTransaction(), > tmobject); > } > else > { > System.out.println ("transaction is closed"); > ProviderTransaction txn =3D m_provider.openTransaction(); > > try > { > checkID(m_provider.getOpenTransaction(), id); > dataObject.setObjectId(id); > > TopicMapDataObject tmdo =3D (TopicMapDataObject) > PersistenceWrapper.load(txn,m_topicMap); > dataObject.setTopicMap(tmdo); > PersistenceWrapper.persist(txn, tmobject); > txn.commit(); > } > catch (Exception ex) > { > txn.rollback(); > throw ex; > } > } > > if (tmobject instanceof TopicImpl) > { > > m_provider.registerTopic(tmobject.getPersistenceId(),(TopicImpl) > tmobject); > } > } > catch (DuplicateObjectIDException ex) > { > throw ex; > } > catch (Exception ex) > { > throw new TopicMapRuntimeException("Storage Exception.", ex); > } > } > > > ____________________________________________________________________ > http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 =E7= =EB=E5=EA=F4=F1=EF=ED=E9=EA=EF=FD =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5. > http://www.freemail.gr - free email service for the Greek-speaking. > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users > ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dick _______________________________________________ Tm4j-users mailing list Tm4...@li... https://lists.sourceforge.net/lists/listinfo/tm4j-users=20 ____________________________________________________________________ http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 =E7=EB= =E5=EA=F4=F1=EF=ED=E9=EA=EF=FD =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5. http://www.freemail.gr - free email service for the Greek-speaking. |
From: Kal A. <ka...@te...> - 2005-12-28 18:57:16
|
Hi George, You need to keep a flag that tracks if your getRemoteTologTmos operation opened the transaction, and then if it did, simply close the transaction using providerTransaction.abort(); - this drops the transaction = completely without committing any changes and because your method only does a = query, its OK to close with an abort() rather than a commit(). Cheers, Kal > -----Original Message----- > From: George Tryfon [mailto:geo...@fr...] > Sent: 27 December 2005 21:58 > To: tm4...@li...; ka...@te... > Subject: Re: [TM4J-users] Hibernate Transactions question >=20 > I found this for the Hibernate Transaction. >=20 > The transaction remain open after I call a Tolog query > (bypassing the TMAPI) >=20 > public String[] getRemoteTologTmos (String tmName, String query, = String > colonName) throws RemoteException > { > try > { > TopicMap _tm =3D TMHelper.getDefault().getTopicMap(tmName); >=20 > org.tm4j.topicmap.TopicMap tm =3D Wrapper.unwrap(_tm); > //_tm.getWrapped()); > QueryEvaluator qe =3D QueryEvaluatorFactory.newQueryEvaluator = (tm); >=20 > //TODO: add rules here... > //qe.addRule ("t($T) :- topic($T)."); >=20 > org.tm4j.topicmap.TopicMapProvider provider =3D tm.getProvider = (); >=20 > ProviderTransaction providerTransaction =3D > provider.getOpenTransaction(); > if (providerTransaction =3D=3D null) > providerTransaction =3D provider.openTransaction(); > System.out.println (query); //<> >=20 > TologResultsSet rSet =3D qe.execute (query); >=20 > System.out.println ("execution done."); //<> > int colonIndex =3D -1; > for (int c=3D0; c<rSet.getNumCols(); c++) > { > if (rSet.getVar(c).equals(colonName)) > colonIndex =3D c; > } >=20 > Vector<String> v =3D new Vector<String> (); > for (int i=3D0; i<rSet.getNumRows(); i++) > { > List list =3D rSet.getRow (i); > org.tm4j.topicmap.TopicMapObject tmo =3D > (org.tm4j.topicmap.TopicMapObject)list.get (colonIndex); > v.add (tmo.getID()); > } >=20 > return v.toArray(new String[0]); > } > catch (Exception ex) > { > throw new RemoteException (ex.getMessage(), ex); > } > } >=20 >=20 > what is your suggestion in order to close the transaction? > Cheers, >=20 > George >=20 >=20 > ----- Original Message ----- > From: "Kal Ahmed" <ka...@te...> > To: "'George Tryfon'" <geo...@fr...>; > <tm4...@li...> > Sent: Tuesday, December 27, 2005 5:30 PM > Subject: RE: [TM4J-users] Hibernate Transactions question >=20 >=20 > Hi George, >=20 > That sounds strange - the save code by itself should always be doing = its > work in its own transaction, if the provider has no open transaction, = as > you > can see in the code you copied in your message. I wonder if there is = some > other call which is starting a transaction and failing to close it (it > might > be in your code, or in the TM4J persistence layer). To track this = down, > perhaps you can insert logging statements in various places in your = code - > especially at request start and end - to see if the provider has an = open > transaction or not. I'm guessing that you are holding the TopicMap = object > between requests ? >=20 > The work-around for this might be to wrap all of your operations for a > single request in one or more transactions (i.e. use the = openTransaction() > and commit() methods explicitly). >=20 > Cheers, >=20 > Kal >=20 > > -----Original Message----- > > From: tm4...@li... [mailto:tm4j-users- > > ad...@li...] On Behalf Of George Tryfon > > Sent: 26 December 2005 13:59 > > To: tm4...@li... > > Subject: [TM4J-users] Hibernate Transactions question > > > > Hello, > > I am developing a TMAPI server using SOAP web services > > the server uses Hibernate and MySQL. > > > > When I create a new TopicMap, the save function inside the > > "org.tm4j.topicmap.hibernate.TopicMapFactoryImpl" > > finds that the transaction is closed, opens a new one and saves the > > changes > > in the database. > > > > the next time I open the TopicMap, again the transaction is closed, = and > > the > > function does the > > same thing, and saves the changes. > > > > The third time? > > Something strange is happening here from the third time and after. > > the transaction found open, the change happens but not saved inside = the > > database. > > I suppose because there is no commit() > > When I close the server and I start it again, all the changes = without > the > > commit() are gone! > > I didn't have this problem when I tried to do the same thing using = RMI > > server and Hibernate > > (I am using SOAP now) > > > > There is more than a week now where I am puzled with this and any = hint, > > idea, anything, would be highly appreciated > > > > could be a good idea to force closing the transaction, or commit? > > > > Thank you in advance. > > Cheers > > > > > > protected void save(PersistenceWrapper tmobject, String id) throws > > DuplicateObjectIDException > > { > > if (id =3D=3D null) > > { > > id =3D m_idgen.getID(); > > } > > > > try > > { > > TopicMapObjectDataObject dataObject =3D = ((TopicMapObjectDataObject) > > tmobject.m_dataObject); > > > > if (m_provider.isTransactionOpen()) > > { > > System.out.println ("transaction is open"); > > checkID(m_provider.getOpenTransaction(), id); > > dataObject.setObjectId(id); > > > > TopicMapDataObject tmdo =3D (TopicMapDataObject) > > PersistenceWrapper.load(m_provider.getOpenTransaction(),m_topicMap); > > dataObject.setTopicMap(tmdo); > > = PersistenceWrapper.persist(m_provider.getOpenTransaction(), > > tmobject); > > } > > else > > { > > System.out.println ("transaction is closed"); > > ProviderTransaction txn =3D m_provider.openTransaction(); > > > > try > > { > > checkID(m_provider.getOpenTransaction(), id); > > dataObject.setObjectId(id); > > > > TopicMapDataObject tmdo =3D (TopicMapDataObject) > > PersistenceWrapper.load(txn,m_topicMap); > > dataObject.setTopicMap(tmdo); > > PersistenceWrapper.persist(txn, tmobject); > > txn.commit(); > > } > > catch (Exception ex) > > { > > txn.rollback(); > > throw ex; > > } > > } > > > > if (tmobject instanceof TopicImpl) > > { > > > > m_provider.registerTopic(tmobject.getPersistenceId(),(TopicImpl) > > tmobject); > > } > > } > > catch (DuplicateObjectIDException ex) > > { > > throw ex; > > } > > catch (Exception ex) > > { > > throw new TopicMapRuntimeException("Storage Exception.", ex); > > } > > } > > > > > > ____________________________________________________________________ > > http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 = =E7=EB=E5=EA=F4=F1=EF=ED=E9=EA=EF=FD = =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5. > > http://www.freemail.gr - free email service for the Greek-speaking. > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through = log > > files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD = SPLUNK! > > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > > _______________________________________________ > > Tm4j-users mailing list > > Tm4...@li... > > https://lists.sourceforge.net/lists/listinfo/tm4j-users > > >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD = SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dick > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users >=20 >=20 > ____________________________________________________________________ > http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 = =E7=EB=E5=EA=F4=F1=EF=ED=E9=EA=EF=FD = =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5. > http://www.freemail.gr - free email service for the Greek-speaking. >=20 |
From: George T. <geo...@fr...> - 2005-12-28 19:20:47
|
Hi Kal That was it, it works OK now Thank you ----- Original Message -----=20 From: "Kal Ahmed" <ka...@te...> To: "'George Tryfon'" <geo...@fr...>; <tm4...@li...> Sent: Wednesday, December 28, 2005 8:16 PM Subject: RE: [TM4J-users] Hibernate Transactions question Hi George, You need to keep a flag that tracks if your getRemoteTologTmos operation opened the transaction, and then if it did, simply close the transaction using providerTransaction.abort(); - this drops the transaction completel= y without committing any changes and because your method only does a query, its OK to close with an abort() rather than a commit(). Cheers, Kal > -----Original Message----- > From: George Tryfon [mailto:geo...@fr...] > Sent: 27 December 2005 21:58 > To: tm4...@li...; ka...@te... > Subject: Re: [TM4J-users] Hibernate Transactions question > > I found this for the Hibernate Transaction. > > The transaction remain open after I call a Tolog query > (bypassing the TMAPI) > > public String[] getRemoteTologTmos (String tmName, String query, Stri= ng > colonName) throws RemoteException > { > try > { > TopicMap _tm =3D TMHelper.getDefault().getTopicMap(tmName); > > org.tm4j.topicmap.TopicMap tm =3D Wrapper.unwrap(_tm); > //_tm.getWrapped()); > QueryEvaluator qe =3D QueryEvaluatorFactory.newQueryEvaluator (tm= ); > > //TODO: add rules here... > //qe.addRule ("t($T) :- topic($T)."); > > org.tm4j.topicmap.TopicMapProvider provider =3D tm.getProvider ()= ; > > ProviderTransaction providerTransaction =3D > provider.getOpenTransaction(); > if (providerTransaction =3D=3D null) > providerTransaction =3D provider.openTransaction(); > System.out.println (query); //<> > > TologResultsSet rSet =3D qe.execute (query); > > System.out.println ("execution done."); //<> > int colonIndex =3D -1; > for (int c=3D0; c<rSet.getNumCols(); c++) > { > if (rSet.getVar(c).equals(colonName)) > colonIndex =3D c; > } > > Vector<String> v =3D new Vector<String> (); > for (int i=3D0; i<rSet.getNumRows(); i++) > { > List list =3D rSet.getRow (i); > org.tm4j.topicmap.TopicMapObject tmo =3D > (org.tm4j.topicmap.TopicMapObject)list.get (colonIndex); > v.add (tmo.getID()); > } > > return v.toArray(new String[0]); > } > catch (Exception ex) > { > throw new RemoteException (ex.getMessage(), ex); > } > } > > > what is your suggestion in order to close the transaction? > Cheers, > > George > > > ----- Original Message ----- > From: "Kal Ahmed" <ka...@te...> > To: "'George Tryfon'" <geo...@fr...>; > <tm4...@li...> > Sent: Tuesday, December 27, 2005 5:30 PM > Subject: RE: [TM4J-users] Hibernate Transactions question > > > Hi George, > > That sounds strange - the save code by itself should always be doing it= s > work in its own transaction, if the provider has no open transaction, a= s > you > can see in the code you copied in your message. I wonder if there is so= me > other call which is starting a transaction and failing to close it (it > might > be in your code, or in the TM4J persistence layer). To track this down, > perhaps you can insert logging statements in various places in your cod= e - > especially at request start and end - to see if the provider has an ope= n > transaction or not. I'm guessing that you are holding the TopicMap obje= ct > between requests ? > > The work-around for this might be to wrap all of your operations for a > single request in one or more transactions (i.e. use the openTransactio= n() > and commit() methods explicitly). > > Cheers, > > Kal > > > -----Original Message----- > > From: tm4...@li... [mailto:tm4j-users- > > ad...@li...] On Behalf Of George Tryfon > > Sent: 26 December 2005 13:59 > > To: tm4...@li... > > Subject: [TM4J-users] Hibernate Transactions question > > > > Hello, > > I am developing a TMAPI server using SOAP web services > > the server uses Hibernate and MySQL. > > > > When I create a new TopicMap, the save function inside the > > "org.tm4j.topicmap.hibernate.TopicMapFactoryImpl" > > finds that the transaction is closed, opens a new one and saves the > > changes > > in the database. > > > > the next time I open the TopicMap, again the transaction is closed, a= nd > > the > > function does the > > same thing, and saves the changes. > > > > The third time? > > Something strange is happening here from the third time and after. > > the transaction found open, the change happens but not saved inside t= he > > database. > > I suppose because there is no commit() > > When I close the server and I start it again, all the changes without > the > > commit() are gone! > > I didn't have this problem when I tried to do the same thing using RM= I > > server and Hibernate > > (I am using SOAP now) > > > > There is more than a week now where I am puzled with this and any hin= t, > > idea, anything, would be highly appreciated > > > > could be a good idea to force closing the transaction, or commit? > > > > Thank you in advance. > > Cheers > > > > > > protected void save(PersistenceWrapper tmobject, String id) throws > > DuplicateObjectIDException > > { > > if (id =3D=3D null) > > { > > id =3D m_idgen.getID(); > > } > > > > try > > { > > TopicMapObjectDataObject dataObject =3D ((TopicMapObjectDataOb= ject) > > tmobject.m_dataObject); > > > > if (m_provider.isTransactionOpen()) > > { > > System.out.println ("transaction is open"); > > checkID(m_provider.getOpenTransaction(), id); > > dataObject.setObjectId(id); > > > > TopicMapDataObject tmdo =3D (TopicMapDataObject) > > PersistenceWrapper.load(m_provider.getOpenTransaction(),m_topicMap); > > dataObject.setTopicMap(tmdo); > > PersistenceWrapper.persist(m_provider.getOpenTransaction()= , > > tmobject); > > } > > else > > { > > System.out.println ("transaction is closed"); > > ProviderTransaction txn =3D m_provider.openTransaction(); > > > > try > > { > > checkID(m_provider.getOpenTransaction(), id); > > dataObject.setObjectId(id); > > > > TopicMapDataObject tmdo =3D (TopicMapDataObject) > > PersistenceWrapper.load(txn,m_topicMap); > > dataObject.setTopicMap(tmdo); > > PersistenceWrapper.persist(txn, tmobject); > > txn.commit(); > > } > > catch (Exception ex) > > { > > txn.rollback(); > > throw ex; > > } > > } > > > > if (tmobject instanceof TopicImpl) > > { > > > > m_provider.registerTopic(tmobject.getPersistenceId(),(TopicImpl) > > tmobject); > > } > > } > > catch (DuplicateObjectIDException ex) > > { > > throw ex; > > } > > catch (Exception ex) > > { > > throw new TopicMapRuntimeException("Storage Exception.", ex); > > } > > } > > > > > > ____________________________________________________________________ > > http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 = =E7=EB=E5=EA=F4=F1=EF=ED=E9=EA=EF=FD =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5= . > > http://www.freemail.gr - free email service for the Greek-speaking. > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through lo= g > > files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUN= K! > > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > > _______________________________________________ > > Tm4j-users mailing list > > Tm4...@li... > > https://lists.sourceforge.net/lists/listinfo/tm4j-users > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3Dick > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users > > > ____________________________________________________________________ > http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 =E7= =EB=E5=EA=F4=F1=EF=ED=E9=EA=EF=FD =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5. > http://www.freemail.gr - free email service for the Greek-speaking. > ____________________________________________________________________ http://www.freemail.gr - =E4=F9=F1=E5=DC=ED =F5=F0=E7=F1=E5=F3=DF=E1 =E7=EB= =E5=EA=F4=F1=EF=ED=E9=EA=EF=FD =F4=E1=F7=F5=E4=F1=EF=EC=E5=DF=EF=F5. http://www.freemail.gr - free email service for the Greek-speaking. |