Chicken and egg problem with @SqlFragmentAlias

I have a entity A with an @Filter definition with an SqlFragmentAlias using entity B.

    @Filter(
            name = "myFilter",
            condition =
                    "{alias}.AHC_ID = {allowed}.AHC_ID and {allowed}.PERSON_ID=:"
                            + AHCScopedFilters.P_PERSONID,
            deduceAliasInjectionPoints = false,
            aliases = {
                @SqlFragmentAlias(alias = "allowed", entity=B.class)
            })

When hibernate creates the factory it blows up with an entity not found exception “B”.
We are using JPA running in jBoss EAP 7 that uses hibernate 5.0

Both classes are defined in the persistence.xml file and what I see is that the metadata.getEntityBindings contains all of our classes. The problem arises in the SessionFactoryImpl constructor that loops through the metaData.entityBindings and then adds them to its own entityPersisters map.
It first processes entity A and when it handles the filter it then throws that exception because it is looking into this persisters map but entity B has not been processes yet and thus is not in that map yet.

Is this a bug or is there some property I can set that will do some 2-phased approach when loading the entities ?

Sounds like a bug. Try to replicate it like this or with our test case template and open a Jira issue afterward.

Thanks Vlad, I was able to re-create the problem in a test case and created https://hibernate.atlassian.net/browse/HHH-12967

Bas

Thanks for the Jira issue and test case.

What is the normal timeframe for someone to read the issue?

There’s no timeframe. The team is focused on 6.0 development and only high priority issues get more attention.

If you want to see it fixed sooner, send us a Pull Request with the fix and we’ll review it. Pull Requests have a higher priority too.

Good to know, I was waiting on some kind of acknowledgement thinking someone monitored that.
I will need to set that up on my private laptop but will try to find some time.

Looking forward to reviewing your Pull Request.