Hibernate 6 migration, get hibernate type from string class name or primitive type

Hi there,
I have in the project code that seems to be written back in 2019…not sure what version of hibernate was used at that point… now i’m trying to upgrade to new spring boot and hibernate and I see the code

                TypeConfiguration typeConfiguration = new TypeConfiguration();
                TypeFactory typeFactory = new TypeFactory(typeConfiguration);
                TypeLocatorImpl typeLocator = new TypeLocatorImpl(new TypeResolver(typeConfiguration, typeFactory));
            Type  myType 
............. if(....)
                Type  myType = typeLocator.entity(valueClass);
              .........
                myType = typeLocator.basic(basicJavaType);

I don’t see those classes anymore in hibernate 6 and can’t find any docs suggesting replacement…
Can you please give me some hints ?
In the end I need a way to get hibernate “Type” from entity class which is string, or type from java primitive type like String, Long etc

Did you read the migration guides?

Thanks for posting this. Yes I’ve seen it, it didn’t provide the answer what to use instead of missing classes or what API to use to get hibernate Type
So if you can share some examples it would be nice…
I think I found some workarounds but I wasn’t an author of original code so I’m not sure if my workaround will work in any case, but at least my code compiles now and I’m able to run tests…

You can use org.hibernate.engine.spi.SessionFactoryImplementor#getMappingMetamodel to access the entity mapping types. Accessing basic types can be done through org.hibernate.engine.spi.SessionFactoryImplementor#getTypeConfiguration by using e.g. the standardBasicTypeForJavaType methods.

Yeah, thanks, I think I can get what logics needs