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.  [ 2 posts ] 
Author Message
 Post subject: dom4jSession: class hierarchy not correctly loaded ?
PostPosted: Wed Feb 07, 2007 4:42 am 
Newbie

Joined: Thu Jun 29, 2006 4:39 pm
Posts: 3
Hello,

i'm facing a problem when loading a class hierarchy as XML with a dom4j-Session.

I have the following setup:

class A
class B extends A
class C extends A

B and C are mapped as joined-subclasses of A.

When i load a Collection that consists of B's and C's as XML the elements are all named <A>:
Code:
<myCollection>
  <A>
    <id>1</id>
    <attribute-of-B>xyz</attribute-of-B>
  </A>
  <A>
    <id>1</id>
    <attribute-of-C>xyz</attribute-of-C>
  </A>
</myCollection>

Even when i explicitly set the 'node'-attributes for the joined-subclasses the name of the XML-elements does not change.
The only thing that can be influenced by the 'node'-attribute is the name of the main-class' element (i.e. A -> mySuperclass) but then all B's and C's will again be of the same element.

Does somebody know if this behaviour is intended ?
I would expect that the 'node'-attribute in the mapping can be defined per concrete class and not only per class hierarchy.

Thanks


Top
 Profile  
 
 Post subject: Re: dom4jSession: class hierarchy not correctly loaded ?
PostPosted: Wed Feb 07, 2007 11:56 am 
Newbie

Joined: Thu Jun 29, 2006 4:39 pm
Posts: 3
To be more exact:

Holgzn wrote:
When i load a Collection that consists of B's and C's as XML the elements are all named <A>


This is the case when the collection is a property of another class (say X).
So, X holds a collections of B's and C's.

The XML shown above results when loading the X (or all X's).

Code:
session.createQuery("from X");


When I directly load all A's

Code:
session.createQuery("from A");


the resulting XML is as expected:

Code:
<B>
   ...
</B>
<C>
   ...
</C>


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