我有 Grails(2.2.1) 项目,想用 Hibernate 创建简单的“模型”类
@Entity
@Table(name="User")
class User {
static mapping = {
datasource 'system'
}
@Id
@GeneratedValue
@Column(name="id")
private Long userId;
@Column(name="email", nullable=false)
private String email;
public User(){
}
@Transient
public Long getUserId(){
return this.userId;
}
@Transient
public String getEmail(){
return this.email;
}
}
但我收到以下错误:
Caused by MappingException: Could not determine type for: org.springframework.validation.Errors, at table: user, for columns: [org.hibernate.mapping.Column(errors)]
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
当我删除所有休眠注释时,应用程序部署在服务器上,但表用户只有两个属性(id、版本)。
谢谢您的帮助 !