grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.77k stars 952 forks source link

GRAILS-8641: No such property: action for class: com.books.Book (with Hibernate domain class) #4336

Closed graemerocher closed 9 years ago

graemerocher commented 12 years ago

Original Reporter: jaetzold Environment: Not Specified Version: 2.0 final Migrated From: http://jira.grails.org/browse/GRAILS-8641

Following the example from http://grails.org/doc/2.0.x/guide/hibernate.html and then http://grails.org/doc/2.0.x/guide/scaffolding.html to use a domain class mapped with hibernate (implemented in java with JPA annotations). Then on attempting to create an instance of the domain class via controller/create the following error happens: {noformat} | Error 2012-01-17 10:47:05,645 ["http-bio-9090"-exec-8] ERROR errors.GrailsExceptionResolver - MissingPropertyException occurred when processing request: [GET] /racetrack/book/create No such property: action for class: com.books.Book. Stacktrace follows: Message: No such property: action for class: com.books.Book Line | Method ->> 19 | create in com.books.BookController


| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run . . in '' ^ 680 | run in java.lang.Thread {noformat} The code for Book, BookController and hibernate.cfg.xml is in principle (as i understand it) exactly as in the example in the documentation. But just to be clear here it is again: {code:title=Book.java} // Some comments here package com.books;

import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id;

@Entity public class Book { private Long id; private String title;

@Id
@GeneratedValue
public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getTitle() {
    return title;
}

public void setTitle(String title) {
    this.title = title;
}

}{code}

{code:title=BookController.groovy} package com.books

class BookController { static scaffold = Book } {code}

{code:xml|title=hibernate.cfg.xml} <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC '-//Hibernate/Hibernate Configuration DTD 3.0//EN' 'http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd'>

{code}

graemerocher commented 12 years ago

sergiuo said: I encountered the same issue. It's specific to 2.0.0, in 1.3.7 it cannot be reproduced.