-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Difference between implicit and explict polymorphism
PostPosted: Thu Mar 15, 2007 9:38 am 
Beginner
Beginner

Joined: Thu Feb 08, 2007 10:40 am
Posts: 46
Hi!

Where can I find documentation about the difference between implicit and explict polymorphism?

I already checked this link, but it does not help.

thanks for help...
etwcn


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 15, 2007 10:34 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
What do you want to know exactly ?
Your link point to the right place in the documentation, theres is also a table at the end to summarize the main differences

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 15, 2007 11:19 am 
Beginner
Beginner

Joined: Thu Feb 08, 2007 10:40 am
Posts: 46
I will try to give an example. Imagine I have table-per-hierachy mapping strategy for vehicle-hierachy:

Code:
<class
   table="Vehicle"
   polymorphism="explicit"   <===============
   name="Vehicle">

   <subclass
      name="Bus" discriminator-value="bus">
   </subclass>

   <subclass
      name="Truck" discriminator-value="truck">
   </subclass>

    ...
    ...

</class>


Now... where is the difference between writing polymorphism="explicit" and polymorphism="implicit" at this mapping?? I tried both - it does not seem to make any difference.

etwcn


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 16, 2007 6:20 am 
Beginner
Beginner

Joined: Thu Feb 08, 2007 10:40 am
Posts: 46
bump


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 16, 2007 6:41 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Quote:
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 by 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).


cf http://www.hibernate.org/hib_docs/v3/re ... pping.html

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.