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: Nhibernate Validator + NHib component + ddl. HOW?
PostPosted: Wed Dec 09, 2009 4:45 am 
Newbie

Joined: Sun Oct 04, 2009 5:36 am
Posts: 8
I just configured my NHibValidator. My NHibernate creates the DB schema. When I set MaxLenght="20" to some property of a class then in the database the length appears in the database column. I am doing this in the NHibValidator xml file. But the problem is that I have components and cannot figure out how to achieve this behaviour. The component is configured correctly in the Customer.hbm.xml file.
Code:
-----------------------------------------------------
public class Customer
{
public virtual string Name{get;set;}
public virtual Contact Contacts{ get; }
}
-----------------------------------------------------
public class Contact
{
public virtual string Address{get;set;}
}
-----------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<nhv-mapping xmlns="urn:nhibernate-validator-1.0"
                        namespace="MyNamespace"
                        assembly="MyAssembly">
<class name="Customer">

   <property name="Name">
     <length max="20"/>
   </property>

   <property name="Contacts">
         <notNull/>
         <valid/>
   </property>

</class>
</nhv-mapping>
-----------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<nhv-mapping xmlns="urn:nhibernate-validator-1.0"
                        namespace="MyNamespace"
                        assembly="MyAssembly">
<class name="Contact">

   <property name="Address">
         <length max="50"/>
         <valid/>
   </property>

</class>
</nhv-mapping>
-----------------------------------------------------


I asked this question on Nhibernate mail listing, stackoverflow, Fabio's blog. No one is going to help me or this is actually a bug/issue. Please help me!


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.