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. |