I have attached a workaround using AspectJ aspect. The patch make sure to bypass query cache to not get any null entity when we see such query.