Any changes in a class will be automatically propagated to all subclasses. If a problem occurs in the subclass due to the changes, CUBRID resolves the corresponding subclass conflict and then displays a message saying that the conflict has been resolved automatically by the system.
Subclass conflicts can occur due to operations such as adding a superclass, or creating/deleting a method or an attribute. Any changes in a class will affect all subclasses. Since changes are automatically propagated, harmless changes can even cause side effects in subclasses.
The simplest subclass conflict occurs when an attribute is added. A subclass conflict occurs if an attribute added to a superclass has the same name as one already inherited by another superclass. In such cases, CUBRID will automatically resolve the problem. That is, the added attribute will not be inherited to all subclasses that have already inherited the attribute with the same name.
The following is an example of adding an attribute to the event class. The superclasses of the soccer_stadium class are the event and the stadium classes, and the nation_code attribute already exists in the stadium class. Therefore, a conflict occurs in the soccer_stadium class if the nation_code attribute is added to the event class. However, CUBRID resolves this conflict automatically.
ALTER CLASS event
ADD ATTRIBUTE nation_code CHAR(3);
If the event class is dropped from the soccer_stadium superclass, the cost attribute of the stadium class will be inherited automatically.
When an attribute is dropped from a class, any resolution specifiers which refer to the attribute by using the INHERIT clause are also removed. If a conflict occurs due to the deletion of an attribute, the system will determine a new inheritance hierarchy. If you don't like the inheritance hierarchy determined by the system, you can determine it by using the INHERIT clause of the ALTER statement. The following is an example of such conflict.
Suppose there is a subclass that inherits attributes from three different superclasses. If a name conflict occurrs in all superclasses and the explicitly inherited attribute is dropped, one of the remaining two attributes will be inherited automatically to resolve the problem.
The following is an example of a subclass conflict. Classes B, C and D are superclasses of class E, and have an attribute whose name is team and the domain is team_event. Class E was created with the place attribute inherited from class C as follows:
create class E under B, C, D
inherit place of C;
In this case, the inheritance hierarchy is as follows:
Suppose that you decide to delete class C from the superclass. This drop will require changes to the inheritance hierarchy. Because the domains of the remaining classes B and D with the game attribute are at the same level, the system will randomly choose to inherit from one of the two classes. If you don't want the system to make a random selection, you can specify the class to inherit from by using the INHERIT clause when you change the class.
ALTER CLASS E
INHERIT game OF D;
ALTER CLASS C
Note If the domain of the game attribute of one superclass is event and that of another superclass is team_event, the attribute that has team_event as the domain will be inherited because team_event is more specific than event (as team_event exists lower in the inheritance hierarchy). In this case, you cannot force the attribute that has event as the domain to be inherited because the event class exists higher in the inheritance hierarchy than team_event.