在新增数据时发生这个问题,求指导。先谢过了!
Struts has detected an unhandled exception:
Messages:
this id generator generates long, integer, short
this id generator generates long, integer, short; nested exception is org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short
File: org/hibernate/id/IdentifierGeneratorFactory.java
Line number: 167
如果你使用的是注解那就找你的想要插入数据的类,对ID的注解为:
@GeneratedValue(strategy=GenerationType.AUTO)
private Long pid;
如果你使用的时配置文件形式
Function_SEQUENCE
[code="java"]
你设置产生的id错误,应该是你配置hibernate的产生主键,
比如:
MYTEMP_TEMP_ID_SEQ
[/code]
意思是这个id 增长器只支持long,integer,short. 你试试用这几个类型的
就比如你写了个方法 public int getAA(){
}
int a=(实例).getAA();
当你用String b=(实例).getAA();会报错类似
hibernate 的主键生成策略不对
[url]http://www.cnblogs.com/flyoung2008/articles/2165759.html[/url]