Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spring.datasource.url=jdbc:mysql://foo.bar.com:12345
- spring.datasource.username=user
- spring.datasource.password=password
- spring.datasource.driver-class-name=com.mysql.jdbc.Driver
- ...
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Isolation;
- import org.springframework.transaction.annotation.Transactional;
- ...
- @Service
- public class ProjectServiceImpl implements ProjectService {
- @Autowired
- ProjectRepository projectRepository;
- @Override
- @Transactional(isolation = Isolation.SERIALIZABLE)
- public Project save(Project project) {
- // there might be some additional logic here, besides the action on repository
- return projectRepository.save(project);
- }
- }
- ...
- import org.springframework.data.repository.CrudRepository;
- import org.springframework.data.repository.query.Param;
- import org.springframework.stereotype.Repository;
- ...
- @Repository
- public interface ProjectRepository extends CrudRepository<Project, Long> {
- ...
- }
- "exception": "org.springframework.transaction.InvalidIsolationLevelException",
- "message": "JtaTransactionManager does not support custom isolation levels by default - switch 'allowCustomIsolationLevels' to 'true'",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement