Hibernate 3 to 5 upgrade - postProcessConfiguration method in AnnotationSessionFactoryBean deprecated

While upgrading from hibernate 3 to hibernate 5, i am finding issues related to customization we were doing.
We have one entity mapped to more than one schemas like same table name in more than one schema which are managed by 2 different applications.

The below method is deprecated in hibernate 4 i think.

protected void postProcessConfiguration(Configuration config) {
        if (!DatabasePlatform.SAMPLE_SCHEMA.equals(DatabasePlatform.DEFAULT_SAMPLE_SCHEMA)) {
            logger.info("Overriding SAMPLE schema name to %s", DatabasePlatform.SAMPLE_SCHEMA);
            Iterator<PersistentClass> classIterator = config.getClassMappings();

            while (classIterator.hasNext()) {
                PersistentClass persistentClass = classIterator.next();
                Iterator<Join> joinIterator = persistentClass.getJoinIterator();
                while (joinIterator.hasNext()) {

                Iterator<org.hibernate.mapping.Collection> collectionIterator = config.getCollectionMappings();
                while (collectionIterator.hasNext()) {

sfb.buildMappings(); is deprecated in 5.

Now i am using hibernate 5.1.15, how can i handle it ?

Where should i accommodate it ? should i override method and do it here ?

    protected SessionFactory buildSessionFactory(LocalSessionFactoryBuilder sfb) {

Try via the MetadataBuilder.applyImplicitSchemaName. Check out this article for an example of how to customize the MetadataBuidler via the MetadataBuilderContributor.

Another way to customize the PersistenceClass is via a custom Tuplizer. Check out the User Guide for an example.