-->
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.  [ 4 posts ] 
Author Message
 Post subject: Sharing <component> in different mapping files
PostPosted: Wed Jul 14, 2004 5:19 am 
Newbie

Joined: Wed Jul 14, 2004 5:06 am
Posts: 2
Hi,

I would like to know if it is possible to share the definition of a <component> between different mapping files.

I am currently doing the following:

Component Comp is used by class A and B. Currently I duplicate the definition of Comp in both mapping files:

<hibernate-mapping>
<class name="A" table="a">
...
<component class="Comp" name="comp">
<property name="p1" type="string" />
...
</component>
...
</class>
</hibernate-mapping>

<hibernate-mapping>
<class name="B" table="b">
...
<component class="Comp" name="comp">
<property name="prop1" type="string" />
...
</component>
...
</class>
</hibernate-mapping>

Maintenance of the component is problematic as any changes requires an update to the mappings for A and B. Is there a way to reference a component from one mapping file to another? I've looked in the documentation and these forums but didn't find and answer.

Thanks.
David


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 6:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I'd say use xml entity references to include some file containing the component mapping. And thing about if this is probably a good sign that it should not be a component but a real entity.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 8:32 am 
Newbie

Joined: Wed Jul 14, 2004 5:06 am
Posts: 2
Thanks. I'll use xml entities.
I'm not sure why I didn't think about it... Anyway, thanks for the help.

David


Top
 Profile  
 
 Post subject: Sharing common component mappings
PostPosted: Wed Jul 21, 2004 3:24 pm 
Newbie

Joined: Mon Jul 19, 2004 5:32 pm
Posts: 1
By xml entity references are you implying using the
<!ENTITY xxxxx SYSTEM "filename"/> option. I tried this but the parser complained since the mapping file already has a reference to a dtd specification.
Can you provide an example.


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