From: George T. <geo...@fr...> - 2005-08-09 20:05:35
|
Hello Kal (and Hibernate users) it's me again :-) because the mail breaks the lines and the message is not very easily readable, I am attaching it as plain text also I don't want to bother you, but I don't know what to do here I thing the CLASSPATH and the .jar files are all OK. (the jars are from "tm4j-bin-0.9.8.zip") When I call the following code: Properties props = new Properties (); props.setProperty ("hibernate.dialect","net.sf.hibernate.dialect.MySQLDialect"); props.setProperty ("hibernate.connection.driver_class","com.mysql.jdbc.Driver"); props.setProperty ("hibernate.connection.url","jdbc:mysql://localhost/etm"); props.setProperty ("hibernate.connection.username", "root"); props.setProperty ("hibernate.connection.password", "123"); TopicMapProviderFactory tmpf = new TopicMapProviderFactoryImpl(); TopicMapProvider provider = tmpf.newTopicMapProvider(props); Map mapFeatures = new HashMap (); TMAPITopicMapSystemImpl tmApiSystImpl = new TMAPITopicMapSystemImpl (tmpf.getClass().getName(), props, mapFeatures); Locator loc = provider.getLocatorFactory().createLocator ("URI", tmName); org.tm4j.topicmap.TopicMap tm = provider.getTopicMap (loc); QueryEvaluator qe = QueryEvaluatorFactory.newQueryEvaluator (tm); TologResultsSet rSet = qe.execute ("topic($T)?"); I get from the "qe.execute ("topic($T)?")" the following Exception: 0 [main] ERROR net.sf.hibernate.impl.IteratorImpl - could not get next result java.sql.SQLException: Operation not allowed after ResultSet closed at com.mysql.jdbc.ResultSet.checkClosed(ResultSet.java:3599) at com.mysql.jdbc.ResultSet.next(ResultSet.java:2464) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:63) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:91) at uk.co.jezuk.mango.iterators.TransformingIterator.next(TransformingIterator.j ava:22) at org.tm4j.tologx.predicates.TopicPredicate.matches(TopicPredicate.java:57) at org.tm4j.tologx.predicates.PredicateBase.matches(PredicateBase.java:57) at org.tm4j.tologx.parser.ClauseList.executePredicate(ClauseList.java:124) at org.tm4j.tologx.parser.ClauseList.execute(ClauseList.java:44) at org.tm4j.tologx.parser.TologQuery.execute(TologQuery.java:108) at org.tm4j.tologx.memory.PreparedQueryImpl.execute(PreparedQueryImpl.java:49) at org.tm4j.tologx.memory.QueryEvaluatorImpl.execute(QueryEvaluatorImpl.java:16 7) at etm.Test.main(Test.java:52) net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:97) at uk.co.jezuk.mango.iterators.TransformingIterator.next(TransformingIterator.j ava:22) at org.tm4j.tologx.predicates.TopicPredicate.matches(TopicPredicate.java:57) at org.tm4j.tologx.predicates.PredicateBase.matches(PredicateBase.java:57) at org.tm4j.tologx.parser.ClauseList.executePredicate(ClauseList.java:124) at org.tm4j.tologx.parser.ClauseList.execute(ClauseList.java:44) at org.tm4j.tologx.parser.TologQuery.execute(TologQuery.java:108) at org.tm4j.tologx.memory.PreparedQueryImpl.execute(PreparedQueryImpl.java:49) at org.tm4j.tologx.memory.QueryEvaluatorImpl.execute(QueryEvaluatorImpl.java:16 7) at etm.Test.main(Test.java:52) Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed at com.mysql.jdbc.ResultSet.checkClosed(ResultSet.java:3599) at com.mysql.jdbc.ResultSet.next(ResultSet.java:2464) at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:63) at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:91) ... 9 more the "net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:91)" belongs in "hibernate2.jar" the "uk.co.jezuk.mango.iterators.TransformingIterator.next(TransformingIterator. java:22)" belongs in "mango.jar" the "org.tm4j.tologx.predicates.TopicPredicate.matches(TopicPredicate.java:57)" is the: addResultsRow(ret, new Object[] {it.next()}); in the: public VariableSet matches(List params) throws TologProcessingException { VariableSet ret = new VariableSet(); initialiseResultsSet(ret); Object p = params.get(0); if (p instanceof Variable) { Iterator it = getTopicMap().getTopicsIterator(); while (it.hasNext()) { addResultsRow(ret, new Object[] {it.next()}); } } else if (p instanceof Topic) { addResultsRow(ret, new Object[] {p}); } return ret; } inside the TopicPredicate.java I understend that the "it.next()" gets: "java.sql.SQLException: Oeration not allowed after ResultSet closed" I suppose the "getTopicMap().getTopicsIterator()" (in the case of Hibernate) is served by: "org.tm4j.topicmap.hibernate.TopicMapImpl" public Iterator getTopicsIterator() { if (m_provider.isTransactionOpen()) { return getTopicsIterator(m_provider.getOpenTransaction()); } else { ProviderTransaction txn = m_provider.openTransaction(); Iterator ret = getTopicsIterator(txn); txn.rollback(); return ret; } } private Iterator getTopicsIterator(ProviderTransaction txn) { TopicMapDataObject tdo = (TopicMapDataObject) load(txn); Iterator rawIt = iterate(txn, "select topic from topic in class org.tm4j.topicmap.hibernate.TopicDataObject where topic.topicMap = ?", tdo, Hibernate.entity(TopicMapDataObject.class)); return new TransformingIterator(rawIt, getWrapper()); } (The Topic Map works and it is editable, only the Tolog is that is not working) Is it possible that the "Iterator it = getTopicMap().getTopicsIterator();" closes the ResultSet (accidentally) and then return the Iterator? Is anybody uses the combination of Hibernate and Tolog without this problem? Thank you again George Tryfon ____________________________________________________________________ http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου. http://www.freemail.gr - free email service for the Greek-speaking. |