We use Hibernate/JPA, Spring, Spring Data and Spring Security in our application. I have a standard User
entity which is mapped using JPA. Further, I have a U
I got the same issue and what I did was just change the propagation on the findByUsername(username)
method to Propagation.REQUIRES_NEW
, I suspected that was a problem with the transactions, so I changed to use a new transaction and that worked well for me. I hope this can help.
@Repository
public interface UserRepository extends JpaRepository {
@Transactional(propagation = Propagation.REQUIRES_NEW)
List findByUsername(String username);
}