Project

General

Profile

Actions

Task #3052

closed

Multiple persistence contexts with separate connection pools

Added by Peter Štrunc almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Peter Štrunc
Category:
Database
Target version:
Start date:
02/09/2022
Due date:
% Done:

100%

Estimated time:
Owner:

Description

In order to have separate connection pool for database logging (and potentially other use-cases) we need to introduce another entity manager, which will operate on a separate datasource and will have its own configuration.

Some work has already been done on this in #3036.

Actions #1

Updated by Peter Štrunc almost 3 years ago

  • Status changed from New to In Progress

Implemetation is in progress in pstrunc/two-datasources

Actions #2

Updated by Peter Štrunc almost 3 years ago

  • Sprint set to Sprint 12.2-1 (Feb 18 - Mar 02)
Actions #3

Updated by Roman Kučera almost 3 years ago

  • Sprint changed from Sprint 12.2-1 (Feb 18 - Mar 02) to Sprint 12.2-2 (Mar 02 - Mar 16)
Actions #4

Updated by Peter Štrunc over 2 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Peter Štrunc to Roman Kučera
  • % Done changed from 0 to 80

I moved implementation to pstrunc/3052-multiple-datasources.

Flyway, Audits and H2 database is working.

TODO:
Documentation

@kucerar would you please review the code and try the functionality with rpt module?

Actions #5

Updated by Peter Štrunc over 2 years ago

Actions #6

Updated by Roman Kučera over 2 years ago

  • Status changed from Needs feedback to In Progress
  • Assignee changed from Roman Kučera to Peter Štrunc

Thx for this feature.
I like the solution. It works nicely.
I tested it with custom reports module, adding new datasource in module is working correctly to.

In PR there are only two small things

Now I am checking Github actions. If it pass and documentation will be finished we can merge it.
After that we can merge it to develop

Actions #7

Updated by Roman Kučera over 2 years ago

Github actions failed
https://github.com/bcvsolutions/CzechIdMng/runs/6154422992?check_suite_focus=true

Error:  Tests run: 9, Failures: 0, Errors: 1, Skipped: 8, Time elapsed: 0.035 s <<< FAILURE! - in eu.bcvsolutions.idm.rpt.report.identity.IdentityIncompatibleRoleReportExecutorIntegrationTest
Error:  testConvertSwagger(eu.bcvsolutions.idm.rpt.Swagger2MarkupTest)  Time elapsed: 0.017 s  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accTestHelper': Unsatisfied dependency expressed through field 'entityManager'; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'javax.persistence.EntityManager' available: expected single matching bean but found 2: org.springframework.orm.jpa.SharedEntityManagerCreator#0,org.springframework.orm.jpa.SharedEntityManagerCreator#1
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'javax.persistence.EntityManager' available: expected single matching bean but found 2: org.springframework.orm.jpa.SharedEntityManagerCreator#0,org.springframework.orm.jpa.SharedEntityManagerCreator#1

@sourek can you check it please?

Actions #8

Updated by Roman Kučera over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 80 to 100

Peter fix it.
Merged into devel.

Actions #9

Updated by Roman Kučera over 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF