如何使用ColdFusion ORM映射基类? [英] How do you map a base class using ColdFusion ORM?

查看:150
本文介绍了如何使用ColdFusion ORM映射基类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个组件,一个基础 Entity 组件:

I have two components, a base Entity component:

<cfcomponent persistent="true">
    <cfproperty name="Id" fieldtype="id" generator="native">
</cfcomponent>

和一个 Client

<cfcomponent persistent="true" extends="Entity">
    <cfproperty name="FirstName">
    <cfproperty name="LastName">
</cfcomponent>


$ b < $ c>,我得到一个错误,说他们被映射为两个不同的表。我知道Hibernate有能力忽略一个基类,但我如何使用ColdFusion的标签,或者我必须回到HBM映射这个功能吗?

However, when I try to create an instance of Client, I get an error that says that they're being mapped as two different tables. I know Hibernate has the ability to ignore a base class, but how would I do it with ColdFusion's tags, or do I have to fall back to HBM mappings for this feature?

附录:删除实体中的 persistent =true无效,

Addendum: Removing the persistent="true" from Entity doesn't work either, Client will act as if it doesn't have an Id property if I do so.

推荐答案

在您的基础Entity类中尝试删除persistent =true并添加mappedSuperClass =true。

In your base "Entity" class try removing persistent="true" and adding mappedSuperClass="true".

<cfcomponent mappedSuperClass="true">
    <cfproperty name="Id" fieldtype="id" generator="native">
</cfcomponent>

您需要将9.0.1更新应用于ColdFusion。

You need to have applied the 9.0.1 update to ColdFusion.

这篇关于如何使用ColdFusion ORM映射基类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆