Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PostgreSQLCITextType to TypeContributor #445

Closed
efrench-novi opened this issue Jun 23, 2022 · 6 comments
Closed

Add PostgreSQLCITextType to TypeContributor #445

efrench-novi opened this issue Jun 23, 2022 · 6 comments
Assignees
Milestone

Comments

@efrench-novi
Copy link

I like the addition of the builtin TypeContributor, but I noticed the PostgreSQLCITextType type was not added. Not sure if it was for a specific reason or an oversight.

@vladmihalcea
Copy link
Owner

I remember some Types were triggering some errors when bootstrapping all of them. Try adding it and run the tests or run it locally on your project and see if it works.

@efrench-novi
Copy link
Author

efrench-novi commented Jun 23, 2022

I had written my own TypeContributor before using PostgreSQLCITextType.INSTANCE and had no issues. I just added it along with yours using the following code and it works without any issues. Using JDK 17 - have not tried with other JDK's.

public class NoviTypeContributor implements TypeContributor {
    @Override
    public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
        contributeType(typeContributions, PostgreSQLCITextType.INSTANCE);
    }

    //
    // copied from https://github.com/vladmihalcea/hibernate-types HibernateTypesContributor
    //
    private void contributeType(TypeContributions typeContributions, BasicType type) {
        typeContributions.contributeType(type);
    }

    private void contributeType(TypeContributions typeContributions, UserType type) {
        if (type instanceof ImmutableType immutableType) {
            typeContributions.contributeType(immutableType, immutableType.getName());
        } else {
            typeContributions.contributeType(type, type.getClass().getSimpleName());
        }
    }
}

@efrench-novi
Copy link
Author

I should also mention I am using hibernate-types-55

@vladmihalcea
Copy link
Owner

I'll try to add it when I have some time and see if the tests pass.

@ecopsdee
Copy link

@efrench-novi i would like to email you. would you mind help me to resolve some configuration issues. your assistance would be helpful. we could connect via twitter or instagram.

@vladmihalcea
Copy link
Owner

Fixed for Hibernate 5 and 4 modules. The Hibernate 6 module fails if the PostgreSQLCITextType is auto-registered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants