Skip to content

Background initialization option for JPA EntityManagerFactory / Hibernate SessionFactory [SPR-13732] #18305

Closed
@spring-projects-issues

Description

@spring-projects-issues

Juergen Hoeller opened SPR-13732 and commented

Traditionally, the bottleneck in the startup performance of Spring applications is the initialization of expensive resources such as a JPA EntityManagerFactory or a Hibernate SessionFactory.

As an alternative to generalized parallel initialization of beans, we might be able to achieve some significant gain through specific background initialization options in LocalContainerEntityManagerFactoryBean / LocalSessionFactoryBean / LocalSessionFactoryBuilder, internally passing the actual build call on to a background thread after configuration validation and in particular dependency resolution happened. The exposed EntityManagerFactory / SessionFactory proxy (which we have for other reasons already) could then simply delegate method invocations to a Future of the target resource until it is known to be resolved, which is likely not to come before the very end of the startup phase.


Issue Links:

Referenced from: commits db1171d, 09cea6e

1 votes, 9 watchers

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions