我正在尝试将现有数据库与Grails一起使用。My DataSource.groovy从以下内容开始:
import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration
dataSource {
configClass = GrailsAnnotationConfiguration.class
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = "12345"
}
我的课堂注释如下:
@Entity
@Table(name = "regexpression", catalog = "tigger")
@SuppressWarnings("serial")
public class Regexpression implements Serializable {
/**
* Attribute regexpId.
*/
private Integer regexpId;
. . .
/**
* <p>
* </p>
* @return regexpId
*/
@Basic
@Id
@GeneratedValue
@Column(name = "regexp_id")
public Integer getRegexpId() {
return regexpId;
}
. . .
当我运行生成的代码时,出现以下错误:
org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [regexpressionInstance.id] on line [40]: groovy.lang.MissingPropertyException: No such property: id for class: org.maflt.flashlit.pojo.Regexpression
这是正确的吗?
我计划将数据库更改为使用id而不是regexp\u id。但我不应该太多。
有什么想法吗?
谢谢