Changes in NativeQueryImpl

Earlier in the project, I used the following class to make debugging easier.

However, now NativeQueryImpl has changed a lot and I don’t understand some details. Previously I used nativeQuery.getQueryParameters().getNamedParameters() to get Map<String,TypedValue>. However, now TypedValue has been completely removed. I was comfortable having a value and type pair. How to get something like this in version 6+?

public class DebugQueryBinder {
    public static String bindQuery(NativeQueryImpl<?> nativeQuery) {
        String queryString = nativeQuery.getQueryString();
        Map<String, TypedValue> namedParameters = nativeQuery.getQueryParameters().getNamedParameters();

        if (!namedParameters.isEmpty()) {
            for (var namedParameter : namedParameters.entrySet()) {
                String regex = "((:%s))".formatted(namedParameter.getKey().trim());
                queryString = queryString.replaceAll(regex, getBindString(namedParameter.getValue()));
        return queryString;

    private static String getBindString(TypedValue typedValue) {
        Type type = typedValue.getType();
        String stringValue = typedValue.getValue().toString();

        if (type instanceof DateType) return "DATE '%s'".formatted(stringValue);
        if (type instanceof TimestampType) return "TIMESTAMP '%s'".formatted(stringValue);
        return "'%s'".formatted(stringValue);

Use org.hibernate.query.spi.QueryParameterBindings via org.hibernate.query.spi.QueryImplementor#getParameterBindings or org.hibernate.query.spi.DomainQueryExecutionContext#getQueryParameterBindings.

Why are QueryParameterBindings inheritor fields private with no way to access them directly?
Getting the bindingMap in its entirety seems logical.

I cannot understand the idea of this restriction

Use visitBindings to visit all the bindings.