You are right, was just using that in this (poor) unit test I made 
quickly late last week, it's not used in the real code.

So the unit test does work and does not have the issue I have in the 
real and much more complex code.

I guess I'll try to bring more of it in this unit test until i break it too.

One of the thing we use, is the neo4j events mechanism(to sync data to 
another system), so i wonder if maybe using that in the context of 
transactions might cause the issue, or maybe some other sort of 
threading issue(what it looked like when i was debugging).

Anyway will try to see if i can give you a failing test and/or better 
info tomorrow or Monday.

Thanks


On 10/8/11 1:51 PM, Mattias Persson wrote:
> The implicit key is "_id_" but that's an implementation detail and shouldn't
> be used to assert correctness of the index in unit tests.
>
> 2011/10/8 Thibaut Colar<tco...@colar.net>
>
>> Actually you are right, seems like "id" is the only one that fails ... i
>> really thought that was implicitly created, could it be possible than
>> somehow it should be but doesn't when using the transaction manager ?
>>
>> On 10/8/11 11:41 AM, Thibaut Colar wrote:
>>> Right, id is an implicit field ... works when not in transaction.
>>> If i remove that test, then I fail on the later index.get.
>>>
>>> As far as deleting the db, it's not in my test, but i removed the folder
>>> in y real code and manually before running the test.
>>>
>>> On 10/8/11 11:10 AM, Rick Bullotta wrote:
>>>> If I remember correctly, neo has an implicit field on each index, and
>> the name is either "id" or "_id".
>>>> On Oct 8, 2011, at 1:58 PM, "Chris Gioran"<
>> chris.gio...@neotechnology.com>    wrote:
>>>>> Hi Thibaut,
>>>>>
>>>>> I noticed the following snippet in your test case code:
>>>>>
>>>>>           long id = node.getId();
>>>>>           node.setProperty("testProp", "test");
>>>>>           index.add(node, "testProp", "test");
>>>>>
>>>>>           Assert.assertEquals(node.getProperty("testProp"), "test");
>>>>>
>>>>>           // Lookup By id
>>>>>           Assert.assertNotNull(graphDb.getNodeById(id));
>>>>>
>>>>>           // Now via Index
>>>>>           Node found = index.get("id", id).getSingle();
>>>>>           Assert.assertNotNull(found);
>>>>>           Assert.assertEquals(found.getId(), id);
>>>>>
>>>>> which leads to the first test failure with a null result returned.
>>>>> Here you are indexing a node with key "testProp" and value "test" but
>>>>> you go on to ask it from the index with key "id" and value its id.
>>>>> Since you haven't added that key/value pair in the index, rightfully
>>>>> you don't get any results - the test fails in my setup even with the
>>>>> native Neo4j transaction manager.
>>>>>
>>>>> I changed that to ask the node from the index with the proper
>>>>> key/value pair and the test passes - the same thing happens a bit
>>>>> further down where you ask the index for a node with a key/value of
>>>>> "testProp"/"prop" (instead of "testProp"/"test"). Moreover, it passes
>>>>> with both the native Transaction Manager and the Atomikos
>>>>> implementation.
>>>>>
>>>>> Also, you are not deleting the db for the test - this means that since
>>>>> you add to the index nodes with the same key/value the test will pass
>>>>> only on the first run as getSingle() on the index hits will find the
>>>>> previously added nodes and it will fail.
>>>>>
>>>>> Could you try that out and see if it solves your issues?
>>>>>
>>>>> I am glad that this functionality is being used in production - please
>>>>> provide any feedback on any problems and what you think of this
>>>>> feature.
>>>>>
>>>>> hope that helps,
>>>>> CG
>>>>>
>>>>> On Thu, Oct 6, 2011 at 7:50 PM, tcolar<tco...@colar.net>    wrote:
>>>>>> I've been trying to make this work for a few days but while it mostly
>> works,
>>>>>> the Lucene index just won't.
>>>>>>
>>>>>> We have a fairly complex setup including neo4j, mysql, mongo and JMS
>> ad
>>>>>> trying to do transactions accross all that with Atomikos.
>>>>>>
>>>>>> Since that is quite complex, I've made a smaller unit test just using
>>>>>> Atomikos and Neo4j to demonstrate the issue:
>>>>>>
>>>>>> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j
>>>>>>
>>>>>> The main test is here:
>>>>>>
>> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j/src/test/java/net/colar/atomikosNeo4j/AtomikosNeo4jTest.java
>>>>>> and results:
>>>>>>
>> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j/test.log
>>>>>> I used
>>>>>>
>> http://digitalstain.blogspot.com/2010/11/using-jotm-as-transactionmanager-in.html
>>>>>> to get me going.
>>>>>>
>>>>>> And my code for that part is here:
>>>>>>
>> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j/src/main/java/net/colar/atomikosNeo4j
>>>>>> I'm thinking that's probably where I'm doing something wrong maybe ?
>>>>>>
>>>>>> I'm probably not doing something right but i can't seem to find what's
>> going
>>>>>> on with Lucene.
>>>>>>
>>>>>> The test works if not using Atomikos but just plain Neo4j
>> Transactions.
>>>>>> Anybody as an idea what is wrong?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>> http://neo4j-community-discussions.438527.n3.nabble.com/Trying-to-use-Neo4J-with-Atomikos-transaction-manager-issues-with-Lucene-index-tp3400319p3400319.html
>>>>>> Sent from the Neo4j Community Discussions mailing list archive at
>> Nabble.com.
>>>>>> _______________________________________________
>>>>>> 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
>>> _______________________________________________
>>> 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

Reply via email to