The following Groovy code creates a GORM-persisted domain class called Foo when written to grails-app/domain/Foo.groovy:
class Foo {
String someField
}
However, if I instead write "public class Foo" the class does NOT get GORM-persisted (i.e. no save() method injected, no database table created, etc.):
public class Foo {
String someField
}
I'm running the latest stable release of Grails (1.1).
Question: Is this a bug or is it the expected behaviour? Why?
Update #1: Related sub-question: Am I the only one hitting this problem? It would be nice to know if anyone else is able to replicate this. Thanks!
-
Sounds like a bug.
I'd enter the details into JIRA and get the answer from the source.
http://jira.codehaus.org/browse/GRAILS
knorv : Thanks for your pointer to the Grails JIRA. Are you able to replicate the problem?Kevin Williams : I'm running 1.0.4 and it doesn't have the problem. -
Groovy classes are public by default (likewise for Groovy methods), so there should be no change in behaviour if you add
public
. However, I cannot reproduce this behaviour/bug in Grails 1.1.1 -
I am not getting this behavior on 1.3.3
check the "isDomainClass" method in DomainClassArtefactHandler.groovy. you will see (at least in 1.3.3) the only types that are excluded are closures and enums
0 comments:
Post a Comment