Detect the ORM correctly for hierarchies.