Skip to content

SpannerSchemaManagementTool singleton prevents having multiple persistence units #406

@yrodiere

Description

@yrodiere

See here:

public class SpannerServiceContributor implements ServiceContributor {
private static final SpannerSchemaManagementTool SCHEMA_MANAGEMENT_TOOL =
new SpannerSchemaManagementTool();

SpannerSchemaManagementTool is effectively a singleton, but it gets injected with information specific to the persistence unit. If it's reused across multiple persistence unit, it will only keep information about the last persistence unit to start, and schema management for the previous persistence units will not work correctly.

You can find more information on the kind of problems this leads to here: quarkusio/quarkus#24742

In order to solve this problem, SpannerServiceContributor should create one instance of SpannerSchemaManagementTool each time the service is initiated. That's what org.hibernate.tool.schema.internal.SchemaManagementToolInitiator, the default implementation, does.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions