Calling stored procedure with a custom type parameter - postgres

I have a stored procedure which gets a custom type - contains 2 simple integers.

CREATE TYPE custom_type AS (
    field1 integer,
    field2 integer
);
CREATE OR REPLACE PROCEDURE my_proc(param1 custom_type) AS $
BEGIN
    -- DO NOTHING FOR NOW
END;
$ LANGUAGE 'plpgsql';

In java I’ve created a CompositeUserType in order to register it in my TypeContributor. But sadly the TypeContributions.contributeType gets only UserType. CompositeUserType does not inherits from UserType.

How can I then register my CompositeUserType?

Or is there a better away to do what I want ?

It seems like this is something we forgot to add to TypeContributor. Can you please create a JIRA ticket (https://hibernate.atlassian.net/) for this enhancement request?
You can use the org.hibernate.annotations.CompositeTypeRegistration annotation to register a composite type. Just place it on an entity or package-info that is scanned by Hibernate.

Will do…
Can you provide an example? where can I put the @CompositeTypeRegistration because I tried it everywhere without success. look like it is being ignored. And I’m getting all the time the error Cannot determine the bindable type for procedure parameter: null

Just place it on an entity or package-info that is scanned by Hibernate.

Just like I wrote. Try putting it on an entity class.

Sorry. But it is not working… simple ignoring it

tried adding this line above some Entity class of mine
@CompositeTypeRegistration( embeddableClass = MyTypeUserType.MyTypeMapper.class, userType = MyTypeUserType.class )

BTW also loading the type contributor via application.yaml is not working.
the only way I managed to load it was to create a org.hibernate.boot.model.TypeContributor file under the folder `/resources/META-INF.services’ - which contains my type contributor full class name.

Registering a TypeContributor only works through that mechanism, which is the standard way to provide pluggable service. See https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html

Sorry. But it is not working… simple ignoring it
tried adding this line above some Entity class of mine

Would you be so kind and try to provide a reproducer for this? We have a test case template that you can use: https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java