I'm trying to use an existing database with Grails. My DataSource.groovy starts with this:
import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration
dataSource {
configClass = GrailsAnnotationConfiguration.class
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = "12345"
}
I have my class annotated as follows:
@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;
}
. . .
When I run the generated code I get the following error:
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
So it appears that Grails is ignoring the @Id annotation on regexp_id. Is that corect?
I plan to change the database to use id instead of regexp_id. But I shouldn't have too.
Any ideas?
Thanks!