transactional

How spring data clean persited entities in transactional method?

房东的猫 提交于 2021-02-19 03:48:31
问题 I need to receive and save huge amount of data using spring data over hibernate. Our server allocated not enough RAM for persisting all entities at the same time. We will definitely get OutOfMemory error. So we need to save data by batches it's obvious. Also we need to use @Transactional to be sure that all data persisted or non was persisted in case of even single error. So, the question: does spring data during @Transactional method keep storing entities in RAM or entities which were

Spring transaction and rollback on multiple tables

走远了吗. 提交于 2021-02-07 19:50:39
问题 I'm struggling on transaction magement using DAO. The scenario is to create new quote that contains a list of quote_line and a customer. If the customer doesn't exist, it will insert it in the table customer. My code is architectures as follow : @Entity @Table(name = "quote") public class Quote { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; //....properties @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "customer_id", nullable = true) private Customer customer;

org.hibernate.HibernateException: No CurrentSessionContext configured

爷,独闯天下 提交于 2021-01-27 06:32:00
问题 Iam using Spring Transactional and AspectJ in my web application. application-context.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http:/

org.hibernate.HibernateException: No CurrentSessionContext configured

别等时光非礼了梦想. 提交于 2021-01-27 06:31:59
问题 Iam using Spring Transactional and AspectJ in my web application. application-context.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http:/

using Async inside a transaction in Spring application

别等时光非礼了梦想. 提交于 2020-12-29 04:59:59
问题 I have a Spring application which updates particular entity details in MySQL DB using a @Transactional method, And within the same method, I am trying to call another endpoint using @Async which is one more Spring application which reads the same entity from MySql DB and updates the value in redis storage. Now the problem is, every time I update some value for the entity, sometimes its updated in redis and sometimes it's not. When I tried to debug I found that sometimes the second application

using Async inside a transaction in Spring application

狂风中的少年 提交于 2020-12-29 04:58:16
问题 I have a Spring application which updates particular entity details in MySQL DB using a @Transactional method, And within the same method, I am trying to call another endpoint using @Async which is one more Spring application which reads the same entity from MySql DB and updates the value in redis storage. Now the problem is, every time I update some value for the entity, sometimes its updated in redis and sometimes it's not. When I tried to debug I found that sometimes the second application

@Transactional annotation works with saveAndFlush?

ε祈祈猫儿з 提交于 2020-06-24 22:26:20
问题 I have the following implementation. @Transactional public void saveAndGenerateResult(Data data) { saveDataInTableA(data.someAmountForA); saveDataInTableB(data.someAmountForB); callAnAggregatedFunction(data); } public void saveDataInTableA(DataA a) { tableARepository.saveAndFlush(a); } public void saveDataInTableA(DataB b) { tableBRepository.saveAndFlush(b); } public void callAnAggregatedFunction() { // Do something based on the data saved from the beginning in Table A and Table B } It is