hibernate框架中使用组件(component)时的注意事项


相信hibernate的组件功能大大提高了hibernate的灵活性,但本菜在第一次使用Component的是后就遇到了一个恨坑爹的问题,浪费了大半天时间
下面说说问题:
在xxx.hbm.xml中配置组件
<component name="address" class="Address">
           <property name="postCode" type="string" column="POSTCODE"></property>
            <property name="identityCode" type="string" column="IDENTITYCODE"></property>
            <property name="address" type="string" column="ADDRESS"></property>
</component>
自认为万无一失,可一运行就报can not parse mapping...具体意思就是无法解析映射,最后我才知道,component的属性class的的值要写写这个组件类的全称!!orz
<component name="address" class="org.csuft.test.Address">
           <property name="postCode" type="string" column="POSTCODE"></property>
            <property name="identityCode" type="string" column="IDENTITYCODE"></property>
            <property name="address" type="string" column="ADDRESS"></property>
</component>

猜你喜欢

转载自huyifan951124.iteye.com/blog/2314858