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] How to validate subclass?
PostPosted: Mon Oct 26, 2009 9:41 am 
Newbie

Joined: Mon Oct 26, 2009 9:37 am
Posts: 1
I have three classes named MedicalExamination, MedicalExaminationVisit and MedicalVisit. MedicalExaminationVisit is inherited from MedicalVisit. MedicalExamination is a property in MedicalExaminationVisit.

When I tried to save only MedicalExamination, validate method of NHibernate Validator works properly. But when I tried to save MedicalExaminationVisit, the method does not validate MedicalExaminationVisit despite it has the same MedicalExamination object. I mean MedicalExamination object has invalid values so MedicalExaminationVisit object shouldn't have been valid.

I use XML files for validation. And in MedicalExaminationVisit.nhv.xml file I use "Valid" constraint for MedicalExamination as you can see below. And other validator files that related with this project are below too.

Code:
<--MedicalExaminationVisit.nhv.xml-->
<class name="NHValidatorDeneme.MedicalExaminationVisit, NHValidatorDeneme">
  <property name="MedicalExamination">
   <valid/>
  </property>
</class>

<--MedicalExamination.nhv.xml-->
<class name="NHValidatorDeneme.MedicalExamination, NHValidatorDeneme">   
<property name="Complaint">
   <length max="20"/>
   <notnull-notempty/>
</property>

<property name="History">
   <notnull-notempty/>
</property>   
</class>

<--MedicalVisit.nhv.xml-->
<class name="NHValidatorDeneme.MedicalVisit, NHValidatorDeneme">   
<property name="Department">
   <length max="20"/>
   <notnull-notempty/>
</property>
</class>


so, how to validate child object or sub-class using xml files? Where am i doing wrong?


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.