-->
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.  [ 1 post ] 
Author Message
 Post subject: Adding custom attributes to mapping document
PostPosted: Wed May 26, 2010 9:16 pm 
Newbie

Joined: Thu Feb 03, 2005 5:27 pm
Posts: 5
I am using code generation to create my C# entity classes from the hbm mappings, and I wish to 'extend' the mapping config to describe customizations to the generator.
My Xml looks something like this (see below)

but when loading the mappings, nhibernate throws and exception about my http://custom/generator/customattribute 'attribute' 'not being declared'
This is because (I believe) there is no schema available for this namespace, and NHibernate is doing strict schema validation.

Would this not be a desirable feature? To be able to 'extend' the mapping xml without it affecting NHibernate (NHibernate should just ignore anything not in its expected namespaces).
How might I achieve this?

Thanks!

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false" xmlns:p="http://custom/generator">
<!--
@System.Runtime.Serialization.DataContract
-->
<class name="Episode" discriminator-value="0">
<!--
@System.Runtime.Serialization.DataMember
-->
<id name="Id" column="Id" type="System.Int32" unsaved-value="0">
<generator class="increment" />
<!-- unsaved-value used to be null and generator was increment in h2.0.3 -->
</id>

<property p:customattribute="true" name="Duration" type="System.Int32">
<column name="Duration" />
</property>
</class>
</hibernate-mapping>


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

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.