I'm coding a little database application.
So I have several entities which are represented in DB with tables.
One entity – one table.
But the so called "main" entities can have any number of entity1 and
entity2. So I made up 2 tables which represent these relations:
Table1 columns:
1. id_main_entity
2. id_entity1
Table2 columns:
1. id_main_entity
2. id_entity2
I am in doubt. According to my OOP way of thinking I decide to make 3
classes
Class MainEntity
Class Entity1
Class Entity2
And try to encapsulate all the db functions in this classes. But it is
ineffective because I must show array of entities in list. So when I
create entity it loads information about itself. Every entity opens
new connection and sends separate command. Besides if user want to
edit one of the main entities
i must load a list of all entities1 entities2.
I think about dataset. I can fill it when program loading. But due to
relationships and information that must be presented in main window I
must load all database at starting time. Any advice? Please help?
|