2011-08-09 78 views
5

我有兩個組成部分,一個基地Entity組件:如何使用ColdFusion ORM映射基類?

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

而且繼承它的Client組件:

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

然而,當我嘗試創建的Client一個實例,我得到一個錯誤那就是說他們被映射爲兩個不同的表格。我知道Hibernate有能力忽略一個基類,但我如何使用ColdFusion的標籤來做到這一點,還是我必須回退到HBM映射這個功能?

附錄:取下Entitypersistent="true"也不管用,Client會表現得好像如果我這樣做,因此不具有財產Id

回答

6

在您的基礎「實體」類中,嘗試刪除persistent =「true」並添加mappedSuperClass =「true」。

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

您需要將9.0.1更新應用於ColdFusion。

+0

進行更改後請確保您的ORMReload()。 – CfSimplicity