All Questions
Tagged with jpa transactions
886
questions
0
votes
2
answers
28
views
global Exception Handler overrules database transaction handler
I am sort of stuck at a particular funny error in a quarkus REST-service that I am currently developing.
My application manages panache entities and I implemented some CRUD operations in a resource ...
1
vote
0
answers
18
views
If I use Spring Data JPA without @Transactional, will the entity not be in a Managed state in the persistence context?
I used Spring Data JPA's JpaRepository(3.2.2), and after checking the implementation, I found out that it uses jakarta.persistence.EntityManager to perform find operations. As far as I know, when ...
0
votes
0
answers
44
views
Updating several data sources in a single transaction
Using Spring Boot, I need to read and update data from 2 different data sources. For this I have configured my application based on https://www.baeldung.com/spring-boot-configure-multiple-datasources ...
0
votes
0
answers
19
views
JPA & PSQL: Allow commit in database-function
TL;DR:
I need a database procedure that runs entirely independent of the calling backend service and commits when finished.
I have a database procedure that might run up to several hours
create ...
0
votes
0
answers
55
views
Repead reads from JPA repository return the same value
I have this code snippet from a Spring Java web app (with spring data and postgresql DB) and I don't understand the results I get from it. Let's say I have an entity that comes down to (some details ...
0
votes
1
answer
26
views
Proper way to cancel / abort a @Transactional method
I have a save method on a @Controller that either saves an object and updates an audit table, or populates an error object and re-renders the edit view. Basically, if you try to make an invalid ...
0
votes
2
answers
59
views
Transactional annotation is not working in pure Spring with EntitManager
I have a simple bookdao class:
@Repository
public class BookDao {
@Autowired
private EntityManager entityManager;
@Transactional
public void create(Book book) {
entityManager....
0
votes
0
answers
17
views
Spring JPA + Hibernate + Rest services + long time transactions
I am using Spring JPA + Hibernate.
I have a master for creation data, which call many REST services. They are located in one @ApiV1RestController, and their implementation is in one @Service.
At ...
0
votes
0
answers
16
views
How do I retain the rollback behaviour on DataJpaTest when annotated by @Transactional(propagation = Propagation.NOT_SUPPORTED)
Similar to How to clean database tables after each integration test when using Spring Boot and Liquibase? I am already using DataJpaTest.
What happened was when I am trying to debug a test file it ...
0
votes
0
answers
20
views
Function to wrap Hibernate Transactions
This is not a problem, exactly, more an open question. I was tired of finding this pattern in many places in this body of code I inherited, so I figured I would make put it all in a function. I can'...
1
vote
2
answers
68
views
java transaction.rollback() not rollbacking the DB
I try to do transactions on my project java, and I realise all transactions don't rollback the rows in DB.
It's a local project (the DB was MySQL on phpmyadmin, all tables in innoDB).
I try to do an ...
0
votes
1
answer
85
views
Spring JPA repository can save but after findBy throws "table not found" error
I have a Spring Boot Test like so :
@SpringBootTest
@AutoConfigureMockMvc(addFilters = false)
@Transactional
public class MyIntegrationTests {
@Autowired
private MockMvc mockMvc;
@...
1
vote
0
answers
17
views
Entity not saved on Junit
Hello im getting trouble with my test code, it is simple but i cannot find out for 3 days.
so help me with it.
it runs on spring boot 3.2 and junit 5 and jpa..
here's my code
here's method that save ...
2
votes
1
answer
321
views
@Rollback @Transactional is not working in acceptance test
I saw similar example in Stackoverflow and elsewhere, but it is not working for me. I use spring boot data jpa, junit5, h2 database and trying to make a simple acceptance test. Tests OK, but I was ...
3
votes
0
answers
53
views
JPA java rollback doesn´t work when I generate an exception
I have a problem with the rollback of a transaction,
Im trying to do a rollback after a validation by sending an exception, but it is not being executed´.
This is my class:
@Service
public class ...