Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.0.2
-
Fix Version/s: None
-
Component/s: Persistence
-
Labels:None
-
Testcase included:yes
Description
Given a simple domain class like this:
class Book {
String title
}
Grails will create a database table called "Book" and a column called "title" with a default length of VARCHAR 255. If you set a value into the "title" attribute of Book that is longer than 255 characters, validation will not prevent hibernate from trying to save the object - so you end up with a JDBC exception that the value for the database column exceeds the size of the column.
Is it possible to have validation validate the default size (i.e. 255) without having to explicitly define a maxSize constraint for String properties?
The workaround for this is to specify size or maxSize constraints for ALL string properties on domain objects.
Sample application with test case attached.
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Graeme Rocher
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Graeme Rocher [ graemerocher ] |
Contegix Support
made changes -
| Project Import | Thu Mar 24 21:22:24 CDT 2011 [ 1301019744151 ] |
Burt Beckwith
made changes -
| Workflow | jira [ 35007 ] | Grails [ 41165 ] |
Burt Beckwith
made changes -
| Workflow | Grails [ 41165 ] | Copy of Grails [ 48594 ] |
Burt Beckwith
made changes -
| Workflow | Copy of Grails [ 48594 ] | Grails [ 56004 ] |
Burt Beckwith
made changes -
| Workflow | Grails [ 56004 ] | Grails2 [ 63548 ] |
Burt Beckwith
made changes -
| Workflow | Grails2 [ 63548 ] | jira [ 76222 ] |
Burt Beckwith
made changes -
| Workflow | jira [ 76222 ] | Grails2 [ 84908 ] |
Peter Ledbrook
made changes -
| Last Reviewed | 01/Jan/10 |
Peter Ledbrook
made changes -
| Workflow | Grails2 [ 84908 ] | jira [ 93332 ] |
Peter Ledbrook
made changes -
| Workflow | jira [ 93332 ] | Grails2 [ 101497 ] |
Bobby Warner
made changes -
| Status | Open [ 1 ] | Closed [ 6 ] |
| Assignee | Bobby Warner [ bobbywarner ] | |
| Resolution | Duplicate [ 3 ] |