I have an entity model in a spring boot project A:

public class MyEntity{
 @Type(type="custom")
 private CustomType type;
}

I have another project B that defines the custom user type and imports the project A library:

public class CustomUserType implements UserType {
   ...
}

public class CustomTypeContributor implements TypeContributor {
   @Override
   public void contribute(TypeContributions tc, ServiceRegistry sr) {
       tc.contributeType(new CustomUserType(), new String[]{"custom"});
   }
}

I want to pass parameters from MyEntity using hibernate's @Parameter to CustomUserType class without specifying the full class path as my project A is not aware of project B. Is there a way to implement this?

I have tried overriding setParameterValues() of ParameterizedType in CustomUserType, but the function is never getting called.

0

There are 0 best solutions below