Skip to content

SQL Server 2016 schemaInspector.relationExists(tableName) Error #806

@Pinellus

Description

@Pinellus

Hi,
I've got a problem starting the javers app.

The first start (without javers tables) is executed without problems.

The second start goes wrong, SQL Exception because javers tries to recreate the schema for the table jv_commit (which already exists in the DB)

Going through the code, I found the error in the org.javers.repository.sql.schema.JaversSchemaManager

private void ensureTable(String tableName, Schema schema) {

        if (schemaInspector.relationExists(tableName)) {
            return;
        }
        logger.info("creating javers table {} ...", tableName);
        schemaManager.create(schema);

    }

The method ensureTable does not recognize that in the DB SQL Server the table jv_commit already exists and therefore launches again the CREATE TABLE.

This behavior is not present in version 5.0.0 of Javers (which I'm currently using to get around the problem).

Also I think that the problem is attributable to the polyjdbc library

The version of SQL Server I use is:
Microsoft SQL Server 2016 - 13.0.1708.0 (X64)
The JPA setting for the dialect is:
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions