infobip / infobip-spring-data-querydsl

Infobip Spring Data Querydsl provides new functionality that enables the user to leverage the full power of Querydsl API on top of Spring Data repository infrastructure.
Apache License 2.0
281 stars 56 forks source link

remove @Transactional(readOnly = true) from QuerydslJdbcRepository #60

Closed AlekseiTokarev closed 2 years ago

AlekseiTokarev commented 2 years ago

After the recent library upgrade, my integration tests which call the save() method started failing with: org.postgresql.util.PSQLException: ERROR: cannot execute INSERT in a read-only transaction

Found that @Transactional(readOnly = true) was added to QuerydslJdbcRepository in the following commit https://github.com/infobip/infobip-spring-data-querydsl/commit/ead317f5fb782178913a90798c420be00c5f8e12#diff-20e913bdb291b1677a4ab45059b3989e660e2996d71033de31c7e1e62839d569R15

I understand that I could add @Transactional(readOnly = false) on top of each test but QuerydslJdbcRepository class is for all CRUD operations and shouldn't be defaulted to readOnly=true.

I'm proposing to delete that annotation to make the caller handle transactions when needed.

Note: org.springframework.data.repository.CrudRepository doesn't have any @Transactional.

lpandzic commented 2 years ago

Fixed in 6.2.2