Generalization in a Database

Asked

Viewed 779 times

0

I’m modeling a job, I stumbled into a situation I don’t know how to proceed:

In a Medical Clinic, a PERSON may be PHYSICAL or LEGAL. THE PATIENT, MAY ONLY BE A PHYSICAL PERSON

Here comes the doubt:

The Financial Officer (Respfin) may be a NATURAL or LEGAL person, provided that it is not both simultaneously:

Modelagem atual

How can I say to Brmodelo that Respfin is a generalization of both Physics and Legal and not simultaneous? What kind of generalization is this?

  • 1

    I think it’s a little confusing. Both patient and responsible financially are PEOPLE, they’re just two different types of people. need to have a specific table for each one? If need be, I would make the two tables as person table specializations.

  • 1

    Good afternoon Washington, I made the specific tables because physical person has many attributes that juridical cannot have, just as physics cannot have cnpj.

  • Maybe you can settle with multiple entity inheritance. Take a look in this booklet.

1 answer

0

In your class model, Respfin will derive from Person only. Person will automatically be either Physical or Legal, as you want. Implementation in Respfin will almost certainly have to be override over inheritance.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.