日期:2014-05-16  浏览次数:20439 次

QBC 通过Heibernate查询 discriminator 配置的属性问题
  在通过QBC查询discriminator配置的属性otype时,Heibernate 无法解析otype属性.
  Heibernate 实体类映射.xml源码
 
<hibernate-mapping>
	<class name="com.bs.phs.domain.soa.mz.Mzbl" table="MZBL" dynamic-insert="true" dynamic-update="true">
		<id name="id" length="32">
			<generator class="uuid.hex"></generator>
		</id>
		<discriminator column="otype" type="string" length="20"></discriminator>
		<property name="jtbc" length="20"></property>
		<property name="gz" length="20"></property>
		<property name="hy"></property>
		<subclass  name="com.bs.phs.domain.soa.mz.MB_Mzbl_Base" discriminator-value="CQXWT">
			<subclass name="com.bs.phs.domain.soa.mz.MB_Mzbl_CJR" batch-size="5" dynamic-insert="true" dynamic-update="true" discriminator-value="CJR">
				<join table="MB_Mzbl_CJR">
					<key column="MZBLID"></key>
					<property name="cjfl" length="20"></property>
					<property name="cjyy" length="20"></property>
					<property name="cjhg" length="20"></property>
					<property name="zlqk" length="20"></property>
					<property name="zlxg" length="20"></property>
					<property name="kfknx" length="20"></property>
					<property name="jtjjqk" length="20"></property>
					<property name="jy" length="100"></property>
				</join>
			</subclass>
		</subclass>
	</class>
</hibernate-mapping>
  

解决方法,在xml中加上
		<property name="otype" type="string" insert="false" update="false">   
            <column name="otype"></column>    
    </property>