2012-03-21 36 views
0

使用playframework,它可以使用getter作爲模型列定義嗎?我嘗試這樣做:使用getters作爲模型屬性

@Column(name="filename") 
    public String getFilename() { 
     return getFile().getName(); 
    } 

,但它沒有工作

回答

0

我不認爲這是可能的。 您可以像往常一樣定義模型列,然後如果需要,可以定義特定的功能以獲得某些特殊功能。

希望這會有所幫助。

瑪塔

0

documentation(可悲的PDF所以它不容易掛):

@Column 
Use this if the naming convention does not match the bean property name to the database 
column or if you need to use quoted identifiers. Otherwise it is not required. 

所有的例子在整個指 「財產」(這是我採取的平均場)。沒有示例顯示註釋方法。