1

投影プロパティをトリミングしようとしていますが、それができません。

def c = Book.createCriteria()
def books = c.list { 
    projections {
        property ("title")
    }
    def now = new Date()
    between('publishingDate', now-45, now+15)
}

条件の「タイトル」フィールドをトリミングしたいのですが、機能しません。助言がありますか?

4

1 に答える 1

2

これは、以下を使用して grails 2.2 で可能になりますsqlProjection

projections {
    sqlProjection 'trim(title) as title', ['title'], [java.sql.Types.VARCHAR]
}
于 2012-11-06T22:51:59.407 に答える