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
Transaction did not seem to be working with spring-data
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
  18 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
 
Newbie  
View profile  
 More options Apr 5 2012, 4:00 pm
From: Newbie <xia.inter...@gmail.com>
Date: Thu, 5 Apr 2012 13:00:38 -0700 (PDT)
Local: Thurs, Apr 5 2012 4:00 pm
Subject: Transaction did not seem to be working with spring-data
I have two repository interfaces that extends from GraphRepository. In
my service layer method, I save data using both repositories. When the
second save fails, the data saved by the first repository gets
persisted in my embedded db.

I am using spring data neo4j 2.0.1 release, neo4j 1.6, and spring
3.1.0.release.

I tried to annotate my method with @Transactional,
@Neo4jTransactional, but neither worked properly. What could be the
problem? Is there documentation that I can follow step-by-step to
setup transaction control with spring-data-neo4j?

Thanks,


 
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.
Newbie  
View profile  
 More options Apr 8 2012, 8:44 am
From: Newbie <xia.inter...@gmail.com>
Date: Sun, 8 Apr 2012 05:44:23 -0700 (PDT)
Local: Sun, Apr 8 2012 8:44 am
Subject: Re: Transaction did not seem to be working with spring-data
Anyone has any insight?

Do I have to revert to use native api to persist data?

On Apr 5, 4:00 pm, Newbie <xia.inter...@gmail.com> wrote:


 
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.
Peter Neubauer  
View profile  
 More options Apr 8 2012, 11:05 am
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Sun, 8 Apr 2012 17:05:13 +0200
Local: Sun, Apr 8 2012 11:05 am
Subject: Re: [Neo4j] Transaction did not seem to be working with spring-data
Got the code somewhere to look at, and the failing test?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j                                - Graphs rule.
Program or be programmed - Computer Literacy for kids.
http://foocafe.org/#CoderDojo


 
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 Apr 8 2012, 1:09 pm
From: Michael Hunger <michael.hun...@neopersistence.com>
Date: Sun, 8 Apr 2012 19:09:16 +0200
Local: Sun, Apr 8 2012 1:09 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data
What does your spring config look like?

Does your service also have an @Transactional? I assume you want to have a tx that spsns both repo calls?

Sent from mobile device

Am 08.04.2012 um 14:44 schrieb Newbie <xia.inter...@gmail.com>:


 
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.
Neil Russell  
View profile  
 More options Mar 19, 11:11 pm
From: Neil Russell <neil.e.russ...@gmail.com>
Date: Tue, 19 Mar 2013 20:11:52 -0700 (PDT)
Local: Tues, Mar 19 2013 11:11 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

Hi,

I'm attaching my question to this thread because it seems so similar.

Using Neo4j 1.8.1 embedded graph database, SDN 2.1.0 in jetty container.

applicationContext.xml has:

<!-- Activates various annotations to be detected in bean classes -->
<context:annotation-config />

<!-- enable the configuration of transactional behavior based on
annotations -->
<tx:annotation-driven />

I have a class ObjectiveComponent  that does its own auto-wire of
ObjectiveReposistory class, which seems to be working fine for us.

I added @Transactional to the update() method, which does a
repository.save() but then does a lot of other stuff, and I want to roll
back all of it if anything else fails withing that update() method.

To test this, I throw a RuntimeException at the bottom of my method after
the repository.save() but before the end of the method, but the
repository.save() still commits and does not roll back.

What am I doing wrong?

I also do not find the @Neo4jTransactional annotation anywhere.

Thanks,

--N


 
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 Mar 20, 1:52 am
From: Michael Hunger <michael.hun...@neopersistence.com>
Date: Wed, 20 Mar 2013 06:52:21 +0100
Local: Wed, Mar 20 2013 1:52 am
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

The rest api only has a tx per request.

So @Transactional doesn't really work with server.

The rest-binding just uses a null-tx

Michael

Sent from mobile device

Am 20.03.2013 um 04:11 schrieb Neil Russell <neil.e.russ...@gmail.com>:


 
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.
Neil Russell  
View profile  
 More options Mar 20, 1:45 pm
From: Neil Russell <neil.e.russ...@gmail.com>
Date: Wed, 20 Mar 2013 10:45:34 -0700 (PDT)
Local: Wed, Mar 20 2013 1:45 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

Hi,

We are using RESTlet with jetty and Spring to handle the REST requests,
which get sent into a helper class
that is annotated @Component (I also tried @Service). I also tried
@Transactional on the ObjectiveRepository class per some notes I found
elsewhere.
None of that works, no new transaction is created when the method fires.

I have so far been able to work around it by coding my own TX management in
every method, very ugly but at least I can get it to work.

So there is no way to use the @Transactional to wrap a method on a jetty
server and have clean code?

--N


 
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.
Neil Russell  
View profile  
 More options Mar 20, 1:47 pm
From: Neil Russell <neil.e.russ...@gmail.com>
Date: Wed, 20 Mar 2013 10:47:01 -0700 (PDT)
Local: Wed, Mar 20 2013 1:47 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

This link seems to imply it is supposed to work:

http://stackoverflow.com/questions/8772619/correct-way-to-get-transac...

--N


 
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 Mar 20, 1:48 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Wed, 20 Mar 2013 18:48:44 +0100
Local: Wed, Mar 20 2013 1:48 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

Currently real transactions are only available if you use SDN against an embedded database in a application or application server or write a server extension for Neo4j which gives you also access to an embedded graph database.

Remote transaction support will come with the binary cypher driver in 2.1 or so.

Cheers

Michael

Am 20.03.2013 um 18:45 schrieb Neil Russell <neil.e.russ...@gmail.com>:


 
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 Mar 20, 1:50 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Wed, 20 Mar 2013 18:50:08 +0100
Local: Wed, Mar 20 2013 1:50 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

But as I stated only against embedded graph databases.

Over REST it will be one transaction per request and uses a Null-Transaction-Handler in the java-rest-binding.

Michael

Am 20.03.2013 um 18:47 schrieb Neil Russell <neil.e.russ...@gmail.com>:


 
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.
Neil Russell  
View profile   Translate to Translated (View Original)
 More options Mar 21, 10:17 am
From: Neil Russell <neil.e.russ...@gmail.com>
Date: Thu, 21 Mar 2013 07:17:35 -0700 (PDT)
Local: Thurs, Mar 21 2013 10:17 am
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

Sorry if I wasn't clear - we are using an embedded database in jetty.

--N


 
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   Translate to Translated (View Original)
 More options Mar 21, 11:37 am
From: Michael Hunger <michael.hun...@neopersistence.com>
Date: Thu, 21 Mar 2013 16:37:11 +0100
Local: Thurs, Mar 21 2013 11:37 am
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

I had never problems with that how do you inject your services? Any way to share a failing test?

Sent from mobile device

Am 21.03.2013 um 15:17 schrieb Neil Russell <neil.e.russ...@gmail.com>:


 
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.
Neil Russell  
View profile  
 More options Mar 22, 1:58 pm
From: Neil Russell <neil.e.russ...@gmail.com>
Date: Fri, 22 Mar 2013 10:58:49 -0700 (PDT)
Local: Fri, Mar 22 2013 1:58 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

basic outline

@Autowired
protected ObjectiveRepository repository;

private static ObjectiveComponent component = null;

private static ApplicationContext ctx;

@Autowired
private PlatformTransactionManager txManager;

public static ObjectiveComponent getInstance() {
if (component == null) {
component = new ObjectiveComponent();
component.init();

}
return component;
}

private void init() {
ctx.getAutowireCapableBeanFactory().autowireBean(component);

}

--N


 
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.
Neil Russell  
View profile  
 More options Apr 1, 11:49 am
From: Neil Russell <neil.e.russ...@gmail.com>
Date: Mon, 1 Apr 2013 08:49:01 -0700 (PDT)
Local: Mon, Apr 1 2013 11:49 am
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

To be clear, annotating any methods in the below class as @Transactional,
does not appear to work - no transaction is started when such methods are
called.

--N


 
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.
Peter Neubauer  
View profile  
 More options Apr 2, 7:04 am
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Tue, 2 Apr 2013 13:04:39 +0200
Local: Tues, Apr 2 2013 7:04 am
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data
If that is the case, maybe your @transactional configuration in Spring
is not set up correctly? That means you should have something like

<tx:annotation-driven transaction-manager="transactionManager" />

In your configuration somewhere?

/peter

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

The authoritative book on graph databases - http://graphdatabases.com
Neo4j questions? Please use SO - http://stackoverflow.com/search?q=neo4j


 
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 Apr 2, 7:26 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Tue, 2 Apr 2013 13:26:19 +0200
Local: Tues, Apr 2 2013 7:26 am
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

Are you sure this works in general? After all you are creating this class
with "new" and don't get it from the spring context where it would be
enhanced (using a proxy or AJ) to add the transactional interceptors.

ctx.getAutowireCapableBeanFactory().autowireBean(component);

just injects dependencies imho, so @Transactional at the dependencies
should work but I doubt that they work in your current class.

On Mon, Apr 1, 2013 at 5:49 PM, Neil Russell <neil.e.russ...@gmail.com>wrote:


 
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.
Neil Russell  
View profile  
 More options Apr 4, 4:51 pm
From: Neil Russell <neil.e.russ...@gmail.com>
Date: Thu, 4 Apr 2013 13:51:51 -0700 (PDT)
Local: Thurs, Apr 4 2013 4:51 pm
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

Hi,

I had a chance to try a few things -

I believe you are correct that calling "autoWire" takes care of basic DI
stuff, but probably not a lot of other stuff.

I changed my code to instead ask the context to getBean() for my class, and
it appears that this does get the @Transactional notation working.

I found several mentions online about @Neo4jTransactional annotation, but I
don't see those in SDN 2.1

( I was wrong, we are still on SDN 2.1, FWIW).

Thanks guys.

--N


 
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 Apr 5, 5:59 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Fri, 5 Apr 2013 11:59:13 +0200
Local: Fri, Apr 5 2013 5:59 am
Subject: Re: [Neo4j] Re: Transaction did not seem to be working with spring-data

@Neo4jTransactional is used internally and is mostly there if you have a
parallel relational transaction-manager in your code and don't want to
change all @Transactionals to use a qualifier.

On Thu, Apr 4, 2013 at 10:51 PM, Neil Russell <neil.e.russ...@gmail.com>wrote:


 
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 »