Skip to content

no transaction is in progress #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
babaiwan opened this issue Feb 22, 2023 · 0 comments
Open

no transaction is in progress #1

babaiwan opened this issue Feb 22, 2023 · 0 comments

Comments

@babaiwan
Copy link

babaiwan commented Feb 22, 2023

it occured to me that " no transaction is in progress"

springBootVersion = "2.1.14.RELEASE"
hibernateVersion = "5.3.17.Final"

the solution is the annoation

    @Transactional(readOnly = true, propagation= Propagation.NOT_SUPPORTED) 
    @RequestMapping(value = "/blobs", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public ResponseEntity store(@RequestPart("inExcelFile") MultipartFile multipartFile) throws IOException, URISyntaxException {
        log.info("Persisting new file: {}", multipartFile.getOriginalFilename());
        EmailAuditPo emailAuditPo = new EmailAuditPo(multipartFile.getOriginalFilename(),
                lobHelper.createBlob(multipartFile.getInputStream(), multipartFile.getSize()));

        emailAuditPo = emailAuditDao.save(emailAuditPo);

        log.info("Persisted {} with id: {}", multipartFile.getOriginalFilename(), emailAuditPo.getId());
        return ResponseEntity.created(new URI("http://localhost:8080/blobs/" + emailAuditPo.getId())).build();
    }

why it happens
https://stackoverflow.com/questions/41559793/hibernate-5-2-and-spring-4-3-non-jpa-javax-persistence-transactionrequiredexc

spring-projects/spring-framework#18936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant