-->
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.  [ 7 posts ] 
Author Message
 Post subject: extends and polymorphic association
PostPosted: Thu May 27, 2004 7:42 am 
Newbie

Joined: Wed Feb 25, 2004 5:28 pm
Posts: 15
Question 1:
In reference guide 5.5:
"..you can use "extends" ..... use of this feature will make the ordering of the mapping documents important "

I am using the schema export tool to generate database schema and want to have classes in a hierachy in separate mapping documents and therefore "extends" is used.
How do I specify the ordering of mapping documents if class A extends class Z?
(because when it comes to mapping docuement for A, a message "cannot extends an upmapped class", as A will be mapped before Z in the default mapping sequence)

Question 2:

class D, E, F extends class W.
class X has a collection of Ws.

load X;
get collection of Ws;
for each W
HERE : how do i know whether W is instance of D or E or F? as

w.getClass() gives something ike "ackage.W$$EnhancerByCGLIB$$da5aeea5"
and
(W instanceof D), (W instanceof E), (W instanceof F) all result in false

Thankyou in advacnce for answers/ideas.
/Kwan


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 7:49 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
Read Chapter 16; inheritance mappings, choose a strategy and implement. (Table per class hierarchy, table per each subclass and table per concrete class)

_________________
-developer


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 7:51 am 
Newbie

Joined: Wed Feb 25, 2004 5:28 pm
Posts: 15
hej !

I have done that I used table per subclass.
/Kwan


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 10:54 am 
Newbie

Joined: Wed Feb 25, 2004 5:28 pm
Posts: 15
I lied.
The case is much more complicated.

class D, E, F extends abstract class G, G extends abstract class W.
class X has a collection of As.
A has a one-to-one relation to W.

load X;
get collection of As for X;
for each A
get W

HERE : how do i know whether W is instance of D or E or F? as

w.getClass() gives something ike "ackage.W$$EnhancerByCGLIB$$da5aeea5"
and
(W instanceof D), (W instanceof E), (W instanceof F) all result in false

table per subclass is used <joined-subclass>.

/Kwan


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 11:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is quite normal behaviour when using proxys. Use Hibernate.getClass(w).equals(F.class) or HibernateProxyHelper.getClass(w).equals(F.class)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 12:41 pm 
Newbie

Joined: Wed Feb 25, 2004 5:28 pm
Posts: 15
tack s


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 12:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Depends on the configuration method you use, in the cfg.xml it is the order of the mapping elements.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.