-
Notifications
You must be signed in to change notification settings - Fork 41.9k
Closed
Labels
status: feedback-providedFeedback has been providedFeedback has been provided
Description
When a repository has a method findBy... spring boot outputs the warning bellow on initialization
2017-07-03 17:29:56.147 WARN 29034 --- [ main] c.a.icatch.jta.TransactionManagerImp : This method needs a transaction for the calling thread and none exists.
Possible causes: either you didn't start a transaction,
it rolledback due to timeout, or it was committed already.
ACTIONS: You can try one of the following:
1. Make sure you started a transaction for the thread.
2. Make sure you didn't terminate it yet.
3. Increase the transaction timeout to avoid automatic rollback of long transactions;
check http://www.atomikos.com/Documentation/JtaProperties for how to do this.
To reproduce this I cloned the spring-boot repo and used the sample spring-boot-sample-jta-atomikos adding findByUsername (diff bellow)
$ git diff
diff --git a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/AccountRepository.java b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/AccountRepository.java
index 6b88cb4..477710a 100644
--- a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/AccountRepository.java
+++ b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/java/sample/atomikos/AccountRepository.java
@@ -19,5 +19,5 @@ package sample.atomikos;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AccountRepository extends JpaRepository<Account, Long> {
-
+ public Account findByUsername(String username);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: feedback-providedFeedback has been providedFeedback has been provided