| 
					
						 I have 2 database tables CSCustomInfo and CSCustomInfoValue. They both have a foreign key to another table CSFieldRegistry. In my CustomInfoValue mapping file, I want to have a property which will check if I have any record in CSCustomInfo for a given CSCustomInfoValue record.
 
 I have written valueInUse  property in my hbm xml which uses formula. But when I fetch records from CSCustomInfoValue, the valueInUse always returns null. Am I doing something wrong?
 
 My CustomInfoValue.hbm.xml looks like
 
 
 
 <?xml version="1.0" encoding="UTF-8"?>
 
 <hibernate-mapping>
 	<class
 		name="com.customfield.CustomInfoValue"
 		table="cscustominfovalue"
 	>
 		<meta attribute="sync-DAO">false</meta>
 		
 		<property
 			name="Value"
 			column="Value"
 			type="string"
 			not-null="false"
 		/>
 		<property
 			name="ShortName"
 			column="ShortName"
 			type="string"
 			not-null="false"
 			length="50"
 		/>
 
 		<property 			name="valueInUse" 			type="java.lang.Integer" 			formula="select ci.ID from CSCustomInfo ci where ci.CSFieldRegistryID = FieldRegistry.ID" 			insert="false" 			update="false" 		/>
 		<many-to-one
 			name="fieldRegistry"
 			column="CSFieldRegistryID"
 			class="com.customfield.FieldRegistry"
 			not-null="false"
 		>
 		</many-to-one>
 		
 
 	</class>	
 </hibernate-mapping> 
					
  
						
					 |