紧急求助:postgre的serial类型的映射问题。
我百思不得其解,为什么每次总出线这个错误。我已经照n个这样的例子进行修改了。serial类型是映射成Integer类型的。可报的这个错误,实在搞不明白。哪位高人帮忙看看。
简单的一个查询语句:
Object users = getHibernateTemplate().get(User.class, user);
User.hbm.xml:
<?xml version= "1.0 "?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN "
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >
<hibernate-mapping package= "freeunite.hibernate ">
<class name= "User " table= "USER ">
<id
column= "ID "
name= "id "
type= "java.lang.Integer "
>
<generator class= "native " />
</id>
<property
column= "PASSWORD "
length= "30 "
name= "password "
not-null= "false "
type= "java.lang.String "
/>
<property
column= "REMARKS "
length= "50 "
name= "remarks "
not-null= "false "
type= "string "
/>
<property
column= "USER_ID "
length= "15 "
name= "userId "
not-null= "true "
type= "java.lang.String "
/>
<property
column= "ROLE "
length= "10 "
name= "role "
not-null= "false "
type= "java.lang.String "
/>
<property
column= "USER_NAME "
length= "20 "
name= "userName "
not-null= "false "
type= "java.lang.String "
/>
</class>
</hibernate-mapping>
User.java:
public class User implements Serializable {
private Integer id;
private String userId;
private String userName;
private String password;
private String role;
private String remarks;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}