How can I use a custom "database class name" with Liquibase 2.0.X as a Maven dependency?

I use Spring, JPA/Hibernate and Maven. Liquibase 2.0.3 is a dependency :

  1.    
            org.liquibase
            liquibase-core
            2.0.3
       
The database is updated using Spring :

  1.    
           
             
       

I’m currently trying to use Postgres. In my application I have some column names that are camelCased.Ex :


  1.    

  1. @Column(nullable=false)
    private String passwordEncoded;
When The queries are made, the columns names are all lowercased, and it doesn’t work! it seems this is because Liquibase adds quotes around camelCased column names so there are not case insensitive.

liquibase.database.core.PostgresDatabase
  1.     @Override
        public String escapeDatabaseObject(String objectName) {
            if (objectName == null) {
                return null;
            }
            if (objectName.contains("-") || hasMixedCase(objectName) || startsWithNumeric(objectName) || isReservedWord(objectName)) {
                return “”" + objectName + “”";
            } else {
                return super.escapeDatabaseObject(objectName);
            }

        }
I see I have to extend this class to change the default behavior. But since you can’t use the “databaseClassName” other than by command line (and I think that parameter doesn’t even exist anymore in 2.0.X ?), I guess I have to add my custom class to a “liquibase.database.ext” package.

I tried adding the custom class to the liquibase project itself? But how can I do that since I use a Maven dependency?

Thanks in advance.



I think it’s not possible to fix this issue…

I tried changing the order the packages are scanned, using the environment property :

liquibase.scan.packages=liquibase.ext,liquibase.change,liquibase.database,liquibase.parser,liquibase.precondition,liquibase.serializer,liquibase.sqlgenerator,liquibase.executor,liquibase.snapshot,liquibase.logging

But, anyway, any order is lost because of :

ServiceLocator#findClasses()

  1. HashSet uniqueClasses = new HashSet(classes);

And It’s not possible to extends DatabaseFactory because the static method DatabaseFactory#getInstance() is used everywhere.




I found the problem. My custom

  •     public void register(Database database) {
            implementedDatabases.add(0, database);
        }
  • I’ll try overriding the DatabaseFactory class Spring uses, to change findCorrectDatabaseImplementation().