Hi,
Can anyone explain me the difference between explicit and implicit polymorphism? Hibernate tutorial has mentioned the difference as -
Implicit polymorphism means that instances of the class will be returned by a query that names any superclass or implemented interface or the class and that instances of any subclass of the class will be returned by a query that names the class itself. Explicit polymorphism means that class instances will be returned only be queries that explicitly name that class and that queries that name the class will return only instances of subclasses mapped inside this <class> declaration as a <subclass> or <joined-subclass>. For most purposes the default, polymorphism="implicit", is appropriate. Explicit polymorphism is useful when two different classes are mapped to the same table (this allows a "lightweight" class that contains a subset of the table columns).
But the defintion is difficult to comprehend. Also I would appreciate if anyone can explain the difference with a suitable example.
Thanks in advance,
Ashish Abrol
|