Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Duplicate
-
Affects Version/s: None
-
Fix Version/s: 1.2-RC1
-
Component/s: Persistence
-
Labels:None
-
Testcase included:yes
Description
grails create-app test
Create test/src/java/test/Animal.groovy
package test import javax.persistence.Entity import javax.persistence.Id import javax.persistence.Table import javax.persistence.GeneratedValue /** * Created by IntelliJ IDEA. * User: sdmurphy * Date: Nov 7, 2009 * Time: 3:12:27 PM * To change this template use File | Settings | File Templates. */ @Entity @Table(name = "name") class Animal { @Id @GeneratedValue int id String name }
Configure hibernate.cfg.xml
<!DOCTYPE hibernate-configuration SYSTEM "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <mapping class="test.Animal" /> </session-factory> </hibernate-configuration>
Modify DataSource.groovy
import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration configClass = GrailsAnnotationConfiguration.class // Needed for Hibernate Annotations
D:\test\test>grails generate-all test.Animal Welcome to Grails 1.2-M4 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: D:\usr\grails-1.2-M4 Base Directory: D:\test\test Resolving dependencies... Dependencies resolved in 737ms. Running script D:\usr\grails-1.2-M4\scripts\GenerateAll.groovy Environment set to development [groovyc] Compiling 2 source files to D:\test\test\target\classes [groovyc] Compiling 1 source file to D:\test\test\target\classes Domain class not found in grails-app/domain, trying hibernate mapped classes... [groovyc] Compiling 1 source file to D:\test\test\target\classes [groovyc] Compiling 1 source file to D:\test\test\target\classes Generating views for domain class test.Animal ... java.lang.NullPointerException: Cannot get property 'name' on null object at SimpleTemplateScript1$_run_closure2.doCall(SimpleTemplateScript1.groovy:38) at SimpleTemplateScript1.run(SimpleTemplateScript1.groovy:36) at _GrailsGenerate_groovy.generateForDomainClass(_GrailsGenerate_groovy:85) at _GrailsGenerate_groovy$_run_closure1.doCall(_GrailsGenerate_groovy:50) at GenerateAll$_run_closure1.doCall(GenerateAll:42) at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:344) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:334) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.processTargets(Gant.groovy:495) at gant.Gant.processTargets(Gant.groovy:480) Error running generate-all: Cannot get property 'name' on null object Application context shutting down... Application context shutdown.
broken by this commit
http://github.com/grails/grails/commit/3c917cb8e16034e321b2470992fc51121681265b