Problema com sort por dateCreated
26/11/2009 00:00
class User {Neste caso está sendo determinado para ordenar o posts do User pela data de criação, mas, mantendo assim eu recebo a seguinte exceção:
static hasMany = [posts: Post]
String userId
String password
Date dateCreated
Profile profile
....
static mapping = {
posts sort:"dateCreated"
}
}
Error 500: Error processing GroovyPageView: could not initialize a collection: [com.grailsinaction.User.posts#1]
Servlet: grails
URI: /hubbub/grails/post/timeline.dispatch
Exception Message: Column not found: POSTS0_.DATECREATED in statement [select posts0_.user_id as user5_1_, posts0_.id as id1_, posts0_.id as id30_0_, posts0_.version as version30_0_, posts0_.content as content30_0_, posts0_.date_created as date4_30_0_, posts0_.user_id as user5_30_0_ from post posts0_ where posts0_.user_id=? order by posts0_.dateCreated]
Caused by: Error processing GroovyPageView: could not initialize a collection: [com.grailsinaction.User.posts#1]
Class: /WEB-INF/grails-app/views/post/timeline.gsp
At Line: [-1]
Para se registrar, clique aqui.