Complex ORM mapping


I am trying to define an ORM mapping with more complex rules than simply connecting one attribute with another.
For example, I have a class model like

  • Person
  • Institution
  • Juristic Person

Both Person and Institution are Juristic Persons, so Juristic Person is a generalization of them.
In the DB, all is in one table: person, institution and general jur. person data.
There is a flag “is_person” in the DB to say that the entry is a person and not an institution.

Now I want to do two things:

  1. define somehow that the DB data goes to Person if the flag is set and goes to institution if not
  2. map all general attributes to my class juristic person, because person and institution are meant to inherit these attributes.

As for 1) - I see no way how I could do this - is there any?
As for 2) - VP seems bugged. When I map the attributes like I want, somehow all my classes in the ORM diagram get to be called “juristic person”… how is that possible? Is this a feature I do not understand?