Avoid problems with DQL when inheritance is present