我的struts+hibernate+servlet在save 实体类时抛出例外,查询则可以正常查询出来。
ERROR [http-8080-Processor24] (JDBCExceptionReporter.java:72) - [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'users' 无效。
ERROR [http-8080-Processor24] (UsersDAO.java:30) - save user failed
org.hibernate.exception.SQLGrammarException: could not fetch initial value for increment generator
配置文件:
<class name="com.zb.model.Users" table="users" schema="dbo" catalog="defokus">
<id name="userid" type="java.lang.Integer">
<column name="userid" />
<generator class="increment"> </generator>
</id>
<property name="username" type="java.lang.String">
<column name="username" length="50" not-null="true" />
</property>
<property name="pwd" type="java.lang.String">
<column name="pwd" length="50" not-null="true" />
</property>
谢谢主要还是对象名 'users' 无效。问题.
是user吧?这个没有错,因为可以query出来。只是save的时候就不行。这个是sqlserver的问题。。。你要么换字段名,要么换数据库吧。。。Create By Any-Extract(WL-AE) 数据挖掘研究院