thank you both for your help! I will give it a try. rgds, canal
________________________________ From: Anders Nawroth <and...@neotechnology.com> To: Neo4j user discussions <user@lists.neo4j.org> Sent: Mon, June 21, 2010 4:57:28 PM Subject: Re: [Neo4j] help: got NotInTransactionException Hi! > If you want to be able to do read operations without the need for a > transactional context you could try using the latest development snapshot. Development snapshot download links has been added here: http://neo4j.org/ /anders > > Cheers, > Tobias > > On Mon, Jun 21, 2010 at 2:12 AM, go canal<goca...@yahoo.com> wrote: > >> Hello, >> Newbie question: I got an exception for this code: >> >> public final String getNotes () { >> if (underlyingNode != null) >> return (String) underlyingNode.getProperty(Constants.PERSON_NOTES, null); >> else >> return null; >> } >> >> I would expect this code can handle the retrieving of the Notes property >> correctly, whether there is a such property or not. But this is the >> exception I saw: >> --------- >> Exception in thread "AWT-EventQueue-0" >> org.neo4j.graphdb.NotInTransactionException: No transaction found for >> current thread >> at >> org.neo4j.kernel.impl.persistence.PersistenceManager.getCurrentTransaction(PersistenceManager.java:232) >> at >> org.neo4j.kernel.impl.persistence.PersistenceManager.getReadOnlyResource(PersistenceManager.java:179) >> at >> org.neo4j.kernel.impl.persistence.PersistenceManager.loadPropertyValue(PersistenceManager.java:72) >> at >> org.neo4j.kernel.impl.core.NodeManager.loadPropertyValue(NodeManager.java:572) >> at >> org.neo4j.kernel.impl.core.NeoPrimitive.getPropertyValue(NeoPrimitive.java:538) >> at >> org.neo4j.kernel.impl.core.NeoPrimitive.getProperty(NeoPrimitive.java:259) >> at org.neo4j.kernel.impl.core.NodeProxy.getProperty(NodeProxy.java:113) >> at com.metaverse.model.Person.getNotes(Person.java:96) >> -------- >> >> This is how I retrieve the Person node: >> >> public Person getPersonByName (String name) { >> Person person = null; >> if (name != null&& name.length()>0) { >> Transaction tx = graphDb.beginTx(); >> try { >> IndexHits<Node> hits = indexService.getNodes(Constants.NODE_TYPE, >> Constants.PERSON_NODE); >> if (hits != null&& hits.size()>0) { >> for (Node hit : hits) { >> if (((String)hit.getProperty(Constants.PERSON_NAME)).equals(name)) { >> person = new Person (hit); >> break; >> } >> } >> } >> } finally { >> tx.finish(); >> } >> } >> return person; >> } >> --------------- >> >> Anything wrong ? >> >> Appreciate any advice! >> rgds, >> canal >> >> >> >> >> _______________________________________________ >> Neo4j mailing list >> User@lists.neo4j.org >> https://lists.neo4j.org/mailman/listinfo/user >> > > > _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user