-->
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: Reusable component mappings
PostPosted: Wed Dec 21, 2005 7:46 pm 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
I'm trying to figure out how I can generate a component mapping that relates to a class I have which can be used in multiple entities without having to re-define it in the mapping file for each entity - that'd quickly become irritating if a change was made to the component.

Note that I don't want the class to be an entity, just a component.

I've had a hunt on the hibernate forums and the suggestion was to use an XML external entity using &entity; placeholders, but I've got no idea what that means. Searching google didn't really answer it for me either.

Can anyone explain how the above works - specifically in relation to reusing component mappings in multiple class mappings?

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 22, 2005 7:22 am 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
read a good XML tutorial. Basically it means that your XML will act like a template, on load the XML parser will replace &entity; constructs with their values which can be defined externally

HTH,
radu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 22, 2005 9:19 am 
Regular
Regular

Joined: Fri Jun 11, 2004 6:27 am
Posts: 81
Location: Yaroslavl, Russia
There are could be problems with using external entities if the mapping file is embedded as a resource. It's not known for sure, what XmlResolover NH uses then loads documents from the assembly.

On the other hand you can make your own, quite simple solution:
1. Extend mapping with your custom elements (preferably in your custom namespace).
2. Make a XSLT, which will replace your element(s) with desired constructs.
3. Enumerate resources manually, load necessary one (ending with hbm.xml), transform with your stylesheet and add to the configuration.

_________________
Best,
Andrew Mayorov // BYTE-force


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 23, 2005 7:37 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Or use NHibernate.Mapping.Attributes (with its [ComponentProperty]) ;)

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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.