开发者

How do you map a base class using ColdFusion ORM?

I have two components, a base Entity component:

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

And a Client component that extends it:

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

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 Cold开发者_StackOverflow中文版Fusion's tags, or do I have to fall back to HBM mappings for this feature?

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.


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

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

You need to have applied the 9.0.1 update to ColdFusion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜