使用getter作为模型属性

时间:2012-03-21 10:57:13

标签: java jpa playframework

使用play框架,可以使用getter作为模型列定义吗?我试过这个:

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

但它没有工作

2 个答案:

答案 0 :(得分:0)

我认为不可能。 您可以像往常一样定义模型列,然后如果需要,可以定义特定函数以获得某些特殊功能。

希望这有帮助。

Marta的

答案 1 :(得分: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.

所有的例子都是指“属性”(我认为是指字段)。没有示例显示注释方法。