Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Declarative transaction management with SpringRestGraphDatabase
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
tims83  
View profile  
 More options Oct 8 2012, 5:03 am
From: tims83 <timmy.sto...@continuum.be>
Date: Mon, 8 Oct 2012 02:03:56 -0700 (PDT)
Local: Mon, Oct 8 2012 5:03 am
Subject: Declarative transaction management with SpringRestGraphDatabase

Hi,

I'm using the Neo4j, spring-data-neo4j and spring-data-neo4j-rest projects
and I'm trying to configure declarative transaction management. The
documentation suggests that I add the following:

<bean id="neo4jTransactionManager"
    class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManager">
        <bean class=
"org.neo4j.kernel.impl.transaction.SpringTransactionManager">
            <constructor-arg ref="graphDatabaseService"/>
        </bean>
    </property>
    <property name="userTransaction">
        <bean class="org.neo4j.kernel.impl.transaction.UserTransactionImpl">
            <constructor-arg ref="graphDatabaseService"/>
        </bean>
    </property>
</bean>

<tx:annotation-driven mode="aspectj" transaction-manager=
"neo4jTransactionManager"/>

<neo4j:config graphDatabaseService="graphDatabaseService" />

<bean id="graphDatabaseService" class=
"org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
    <constructor-arg index="0" value="http://localhost:7474/db/data" />
</bean>

When I run this configuration, I'm getting the following exception:

org.springframework.data.neo4j.rest.SpringRestGraphDatabase cannot be cast
to org.neo4j.kernel.AbstractGraphDatabase

This leaves me clueless on how to configure the declarative transaction
management. Does this happen because a transaction can span over multiple
REST calls to the server? Any advice would be much appreciated.

Thanks,
Timmy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Oct 8 2012, 12:41 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Mon, 8 Oct 2012 18:41:25 +0200
Local: Mon, Oct 8 2012 12:41 pm
Subject: Re: [Neo4j] Declarative transaction management with SpringRestGraphDatabase

First of all, there are no transactions over the http-interface.

There is a mode of the java-rest-bindings that take all operations within a tx-boundary and send them to the server as a single batch-request. But it has some shortcomings, e.g. not allowing reads of the data you've just written and others.

So SDN uses the non-tx (or tx per request mode) of the REST API, so that there are no real transactional guarantees in this mode.

SpringRestGraphDatabase actually extends AbstractGraphDatabase, so the error that pops up is unexpected. Can you post the full exception?

Which versions of SDN and Neo4j are you using?

Michael

Am 08.10.2012 um 11:03 schrieb tims83:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tims83  
View profile  
 More options Oct 9 2012, 3:38 am
From: tims83 <timmy.sto...@continuum.be>
Date: Tue, 9 Oct 2012 00:38:32 -0700 (PDT)
Local: Tues, Oct 9 2012 3:38 am
Subject: Re: [Neo4j] Declarative transaction management with SpringRestGraphDatabase

Thanks for your reply. I'm using SDN version 2.0.1.RELEASE and Neo4J
version 1.6.3. When I use version 1.7.2 or 1.8 of Neo4J, I'm getting
another exception (see below). But probably this makes sense right, since
declarative transaction management cannot be used when using the REST
approach. I understand that it's one transaction per request. If multiple
requests are made in a single method, they would all run in a different
transaction. Any ideas on what a good approach would be to handle
situations like this? What if one of those calls fails?

org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name
'org.neo4j.kernel.impl.transaction.SpringTransactionManager#19713ea'
defined in URL [file:/applicationContext-db.xml]: Unsatisfied dependency
expressed through constructor argument with index 0 of type
[org.neo4j.kernel.GraphDatabaseAPI]: Could not convert constructor argument
value of type [org.springframework.data.neo4j.rest.SpringRestGraphDatabase]
to required type [org.neo4j.kernel.GraphDatabaseAPI]: Failed to convert
value of type 'org.springframework.data.neo4j.rest.SpringRestGraphDatabase'
to required type 'org.neo4j.kernel.GraphDatabaseAPI'; nested exception is
java.lang.IllegalStateException: Cannot convert value of type
[org.springframework.data.neo4j.rest.SpringRestGraphDatabase] to required
type [org.neo4j.kernel.GraphDatabaseAPI]: no matching editors or conversion
strategy found

Thanks,
Timmy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Oct 9 2012, 3:52 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Tue, 9 Oct 2012 09:55:21 +0200
Local: Tues, Oct 9 2012 3:55 am
Subject: Re: [Neo4j] Declarative transaction management with SpringRestGraphDatabase

Timmy,

to use Neo4j 1.7 or 1.8 you should upgrade to SDN 2.1.RC4.

If you want to encapsulate multiple operations in one call you can either use a cypher statement which contains the operations that you want to execute.

Or you use the RestAPI.executeBatch() method which records your calls within the callback and then sends them all over in a single rest-batch-operation (which is executed in a single tx) and fills in read-values after the request returns.

See:

http://docs.neo4j.org/chunked/milestone/rest-api-batch-ops.html
https://github.com/neo4j/java-rest-binding/blob/master/src/test/java/...

HTH

Michael

Am 09.10.2012 um 09:38 schrieb tims83 <timmy.sto...@continuum.be>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tims83  
View profile  
 More options Oct 9 2012, 4:58 am
From: tims83 <timmy.sto...@continuum.be>
Date: Tue, 9 Oct 2012 01:58:33 -0700 (PDT)
Local: Tues, Oct 9 2012 4:58 am
Subject: Re: [Neo4j] Declarative transaction management with SpringRestGraphDatabase

Thanks Michael! I'm going to play around with it. ;-)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »