Advertisement
Guest User

Untitled

a guest
May 15th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. spring.datasource.url=jdbc:mysql://foo.bar.com:12345
  2. spring.datasource.username=user
  3. spring.datasource.password=password
  4. spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  5.  
  6. ...
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Service;
  9. import org.springframework.transaction.annotation.Isolation;
  10. import org.springframework.transaction.annotation.Transactional;
  11. ...
  12.  
  13. @Service
  14. public class ProjectServiceImpl implements ProjectService {
  15.  
  16. @Autowired
  17. ProjectRepository projectRepository;
  18.  
  19. @Override
  20. @Transactional(isolation = Isolation.SERIALIZABLE)
  21. public Project save(Project project) {
  22.  
  23. // there might be some additional logic here, besides the action on repository
  24.  
  25. return projectRepository.save(project);
  26. }
  27.  
  28. }
  29.  
  30. ...
  31. import org.springframework.data.repository.CrudRepository;
  32. import org.springframework.data.repository.query.Param;
  33. import org.springframework.stereotype.Repository;
  34. ...
  35.  
  36. @Repository
  37. public interface ProjectRepository extends CrudRepository<Project, Long> {
  38.  
  39. ...
  40.  
  41. }
  42.  
  43. "exception": "org.springframework.transaction.InvalidIsolationLevelException",
  44. "message": "JtaTransactionManager does not support custom isolation levels by default - switch 'allowCustomIsolationLevels' to 'true'",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement