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.
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
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.