Auto apply UserType for generic type?


I was wondering if there is a way to auto-apply customized UserType to a generic type(i.e. List) without having to add @Type(…) annotation to the corresponding field?

I found a work around to auto-apply customized UserType for non-generic type by adding the code below to our own dialect implementation. However, this doesn’t work for generic type due to type erasure.

public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
super.contributeTypes( typeContributions, serviceRegistry );
typeContributions.contributeType(new CustomType(new SomeUserType(), new String[]{“google.registry.persistence.SomeUserType”}));

Any help is greatly appreciated!