PersistenceProviderResolver resolver = PersistenceProviderResolverHolder.getPersistenceProviderResolver();
List<PersistenceProvider> providers = resolver.getPersistenceProviders();
for (PersistenceProvider provider : providers) {
LoadState loadstate = provider.getProviderUtil().isLoadedWithoutReference(entity, attributeName);
if(loadstate == LoadState.LOADED) {
return true;
} else if (loadstate == LoadState.NOT_LOADED) {
return false;
} // else continue
}
//None of the providers could determine the load state try isLoadedWithReference
for (PersistenceProvider provider : providers) {
LoadState loadstate = provider.getProviderUtil().isLoadedWithReference(entity, attributeName);
if(loadstate == LoadState.LOADED) {
return true;
} else if (loadstate == LoadState.NOT_LOADED) {
return false;
} // else continue