相信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>
hibernate框架中使用组件(component)时的注意事项
最新推荐文章于 2019-11-22 15:31:31 发布
本文通过实例详细介绍了在使用Hibernate框架时,如何正确配置<component>标签的class属性。作者分享了一个常见错误——未指定组件类的全限定名,并提供了正确的解决方案。
1272

被折叠的 条评论
为什么被折叠?



