Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2 final
-
Fix Version/s: 2.3-M2
-
Component/s: None
-
Labels:None
-
Patch Submitted:Yes
-
Patch attached:Yes
Description
If I try and mock a domain class that's being imported through hibernate, (ie not using groovy/GORM to define the class), grails will throw an error if I didn't define a version property in the hibernate mapping (either annotation or xml):
"Version property not found, but required in domain class "
This way it's impossible to mock domain classes that are shared with another Java projects.
A possible solution would be allowing mappings override with a Domain***Mappings.groovy (just like we define the GORM constraints).
Activity
Graeme Rocher
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Graeme Rocher [ graemerocher ] |
Ales Smodis
made changes -
| Attachment | grails-1.3.5-default_grails_domain_class.patch [ 51502 ] |
Contegix Support
made changes -
| Project Import | Thu Mar 24 21:22:24 CDT 2011 [ 1301019744151 ] |
Graeme Rocher
made changes -
| Patch attached | Yes | |
| Fix Version/s | 1.4-M1 [ 11040 ] | |
| Patch Submitted | [Yes] |
Graeme Rocher
made changes -
| Fix Version/s | 1.4-M1 [ 11040 ] | |
| Fix Version/s | 1.4-M2 [ 12504 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.0-M2 [ 12805 ] | |
| Fix Version/s | 2.0-M1 [ 12504 ] |
Burt Beckwith
made changes -
| Workflow | jira [ 30067 ] | Grails [ 40224 ] |
Burt Beckwith
made changes -
| Workflow | Grails [ 40224 ] | Copy of Grails [ 47657 ] |
Burt Beckwith
made changes -
| Workflow | Copy of Grails [ 47657 ] | Grails [ 55067 ] |
Burt Beckwith
made changes -
| Workflow | Grails [ 55067 ] | Grails2 [ 62618 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.0-RC1 [ 12803 ] | |
| Fix Version/s | 2.0-M2 [ 12805 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.0.1 [ 13005 ] | |
| Fix Version/s | 2.0-RC1 [ 12803 ] |
Burt Beckwith
made changes -
| Workflow | Grails2 [ 62618 ] | jira [ 71172 ] |
Burt Beckwith
made changes -
| Workflow | jira [ 71172 ] | Grails2 [ 79215 ] |
Peter Ledbrook
made changes -
| Last Reviewed | 01/Jan/10 |
Peter Ledbrook
made changes -
| Workflow | Grails2 [ 79215 ] | jira [ 87403 ] |
Peter Ledbrook
made changes -
| Workflow | jira [ 87403 ] | Grails2 [ 95558 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.0.2 [ 13064 ] | |
| Fix Version/s | 2.0.1 [ 13005 ] |
James Cook
made changes -
| Status | Open [ 1 ] | Edit [ 10000 ] |
| Flagged | Impediment [ 10010 ] |
Peter Ledbrook
made changes -
| Status | Edit [ 10000 ] | Open [ 1 ] |
Peter Ledbrook
made changes -
| Flagged | Impediment [ 10010 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.0.3 [ 13094 ] | |
| Fix Version/s | 2.0.2 [ 13064 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.0.4 [ 13099 ] | |
| Fix Version/s | 2.0.3 [ 13094 ] |
Jeff Brown
made changes -
| Fix Version/s | 2.2 [ 13093 ] | |
| Fix Version/s | 2.0.4 [ 13099 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.3 [ 13311 ] | |
| Fix Version/s | 2.2-RC1 [ 13093 ] |
Graeme Rocher
made changes -
| Fix Version/s | 2.3-M2 [ 13457 ] | |
| Fix Version/s | 2.3-M1 [ 13311 ] |
I have exactly the same problem (using Grails 1.3.5) with JPA-annotated Java classes instead of using native Grails domain classes. The problem essentially lies in mocking the domain classes with the org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass which throws an exception in the constructor if version or identifier properties are missing. The reason for requiring these fields is not clear to me, so I modified the source and removed the said part in the constructor. All tests pass upon rebuilding Grails, as do tests in my application now with Grails modified in this way. I'll be attaching the relevant patch.