使用ORM时如何向CFC添加数组属性?

时间:2012-03-29 15:18:31

标签: hibernate orm coldfusion coldfusion-9

我正在使用Coldfusion ORM(Hibernate),并将cfc映射到数据库表。一切正常,但现在我想将数组属性添加到数据库中不存在的CFC。我需要向属性添加哪些属性才能导致ORM错误?

component extends="_base" persistent="true" accessors="true" table="foo" {

    // Primary Key
    property name='fooID' fieldtype='id' column='fooID' generator='native';

    // Properties  
    property name='fooTypeID' ormtype='int'; 
    property name='fooName' ormtype='string'; 

    // Properties that are not database columns or relationships
    property name='fooArray' type='array' <= causes error


    public array function $toString() output="false" {
        var toStringMessage = 'foo = [ 
        fooID: ' & getFooID() & ' 
        fooTypeID: ' & getfooTypeID() & ' 
        fooName: ' & getfooName() & ' 
            fooArray: ' & getfooArray() & ' 
        ]';

        return toStringMessage;
    }

}

1 个答案:

答案 0 :(得分:6)

关闭该物业的持久性:

property name='fooArray' type='array' persistent='false';