Skip to content

Commit

Permalink
[cleanup] Fix dangling transactions which were not properly commited
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Bégaudeau <[email protected]>
  • Loading branch information
sbegaudeau committed Jun 24, 2024
1 parent 276afa4 commit 0d89655
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.sirius.web.domain.boundedcontexts.semanticdata.services.api.ISemanticDataUpdateService;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Timer;
Expand Down Expand Up @@ -61,6 +62,7 @@ public EditingContextPersistenceService(ISemanticDataUpdateService semanticDataU
}

@Override
@Transactional
public void persist(IEditingContext editingContext) {
long start = System.currentTimeMillis();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Timer;
Expand Down Expand Up @@ -85,6 +86,7 @@ public EditingContextSearchService(IProjectSearchService projectSearchService, I
}

@Override
@Transactional(readOnly = true)
public boolean existsById(String editingContextId) {
return new UUIDParser().parse(editingContextId)
.map(AggregateReference::<Project, UUID>to)
Expand All @@ -93,6 +95,7 @@ public boolean existsById(String editingContextId) {
}

@Override
@Transactional(readOnly = true)
public Optional<IEditingContext> findById(String editingContextId) {
return new UUIDParser().parse(editingContextId)
.flatMap(this.projectSearchService::findById)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.eclipse.sirius.web.application.studio.services.api.IStudioColorPalettesLoader;
import org.eclipse.sirius.web.domain.boundedcontexts.semanticdata.services.api.ISemanticDataSearchService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* Used to contribute the domain and view models found to the editing context.
Expand All @@ -62,6 +63,7 @@ public EditingContextInitializer(ISemanticDataSearchService semanticDataSearchSe
}

@Override
@Transactional(readOnly = true)
public void preProcess(IEditingContext editingContext) {
if (editingContext instanceof EditingContext siriusWebEditingContext) {
List<Domain> domains = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
* Spring Data JDBC configuration.
*
* @author sbegaudeau
*/
@Configuration
@EnableTransactionManagement
@EnableJdbcRepositories(basePackages = { "org.eclipse.sirius.web.domain" })
public class JDBCConfiguration {
}

0 comments on commit 0d89655

Please sign in to comment.