Details
-
Type:
Sub-task
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.3.1
-
Fix Version/s: 1.2-M1
-
Component/s: Persistence
-
Labels:None
Description
I would be nice if you could specify a default sort and order for domain classes, like:
class NewsArticle { static defaultSort = 'publishedAt' static defaultOrder = 'desc' String title Date publishedAt .... }
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
I found that this doesn't work when the property is a camelCased word. For example:
<pre>
class Book {
Date dateCreated
}
class Author {
static hasMany = [books:Book]
static mapping = { books sort:'dateCreated' }
}
</pre>
Running the app produces an exception similar to the following:
ERROR util.JDBCExceptionReporter - Column not found: BOOKS0_.DATECREATED in statement ...
The problem is that the database column is date_created, not datecreated. The camelHumps property should be translated in the query to two words separated by an underscore.