在ssh组合中,用getHibernateTemplate().save();的时候报告异常:
Hibernate: insert into NoteMessage (buyerName, Phone, email, Address, remark) values (?, ?, ?, ?, ?)
Hibernate: select last_insert_id()
//这个是用show_sql 打出来的语句
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not insert: [com.web.domain.NoteBook]; uncategorized SQLException for SQL [select last_insert_id()]; SQL state [HY000]; error code [195]; [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer] 'last_insert_id ' 不是可以识别的 函数名。; nested exception is java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer] 'last_insert_id ' 不是可以识别的 函数名。
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer] 'last_insert_id ' 不是可以识别的 函数名。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
我看了下在数据库中已经插入了新的数据,应该是在 select last_insert_id()出错误,我连接的是sqlserver数据库,在执行其它操作更新,删除,查询的时候都没有问题,就是插入不行,这是怎么回事啊?
------解决方法--------------------------------------------------------
hibernate.dialect不对