Skip to content

Custom JDBC table names naming strategy #80

@dmanix

Description

@dmanix

In my Spring Data JDBC project I have custom NamingStrategy (predefined prefix is added to entity name):

private static final String TABLE_NAME_PREFIX = "foo_";

@Bean
    public NamingStrategy namingStrategy() {
        return new NamingStrategy() {

            @Override
            public String getTableName(Class<?> type) {

                Assert.notNull(type, "Type must not be null");
                return TABLE_NAME_PREFIX + ParsingUtils.reconcatenateCamelCase(type.getSimpleName(), "_");
            }
        };
    }

I want to have the same table names generated by AnnotationProcessor in Q-classes.
What is recommended way to adjust it in AnnotationProcessor?

It seems that enough should be:

  1. writing my own ExtendedTypeFactory implementation which extends CustomExtendedTypeFactory and overrides one method: getTableNameEntityType model).
  2. overriding createTypeFactory method of SpringDataJdbcAnnotationProcessorBase and use implementation of ExtendedTypeFactory (created in first step) instead of CustomExtendedTypeFactory

But it turns out it is impossible due to CustomExtendedTypeFactory class visibility issue. What is the reason this class is not an public class?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions