4
I’m studying some design patterns, and right now I’m learning about the pattern Observer. I’ve read books, I’ve seen some classes on Youtube, I’ve done the examples and everything.
But now I would like to implement in practice inserting data into the database, to use in a project that I am currently working on.
My situation: I have a base with 3 tables(Setor
, Pessoa
, PessoaSetor
). It is a relationship "many for many". Every sector can have more than one responsible, this information is in the table Personal.
What I need: every time a person is registered in a sector, send a notification to those responsible for the sector. In this case, the notification may be a table by table.
The best thing would be for you to give a situation, a problem you want to solve by default. It is possible to implement an Observer in banks in numerous ways, using stored procedures/functions or triggers, will depend on the case.
– BrunoRB
[Update] I put my problem I want to solve
– Fábio Lima
This is the perfect situation to use triggers (which are essentially "standard" Observers of rdbms’s), if you specify which database you are using will facilitate because the use varies by type.
– BrunoRB
@Fábiolima The answer solved your problem? Do you think you can accept it? If you don’t know how, check out the [tour] how to do this. This would help a lot to indicate that the solution was useful to you and help everyone entdner it. You can also vote for anything on the entire site.
– Maniero