怎么处理这个异常

问题描述

在新增数据时发生这个问题,求指导。先谢过了!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, shortFile: org/hibernate/id/IdentifierGeneratorFactory.javaLine number: 167

解决方案

如果你使用的是注解那就找你的想要插入数据的类,对ID的注解为:@GeneratedValue(strategy=GenerationType.AUTO)private Long pid;如果你使用的时配置文件形式<id name="pid" type="java.lang.Long"> <column name="PID" precision="10" scale="0" /> <generator class="sequence" > <param name="sequence">Function_SEQUENCE</param> </generator></id>
解决方案二:
hibernate 的主键生成策略不对http://www.cnblogs.com/flyoung2008/articles/2165759.html
解决方案三:
http://zhidao.baidu.com/link?url=dc4AGp8AdhLIUTrTQsJ05toS7bCDcxpH_NcaeWj80zSN85vEs8UXQhS6ykdXZSq7S2CSmAvjpctlwXic_0_jcq
解决方案四:
意思是这个id 增长器只支持long,integer,short. 你试试用这几个类型的 就比如你写了个方法 public int getAA(){}int a=(实例).getAA();当你用String b=(实例).getAA();会报错类似
解决方案五:
你设置产生的id错误,应该是你配置hibernate的产生主键,比如:<generator class="com.mypackage.BigDecimalGenerator"> <param name="sequence">MYTEMP_TEMP_ID_SEQ</param></generator>

时间: 2024-08-03 23:14:51

怎么处理这个异常的相关文章

process-Widget启动报异常。请求解决

问题描述 Widget启动报异常.请求解决 Unable to launch app or broadcast Intent process is bad act=android.appwidget.action.APPWIDGET_ENABLED 怎么回事啊!!! 开始还好好的,后来不晓得怎么了,装widget一直报这个错,不晓得抽什么风, 网上说神马卸掉重装,卸掉关机重启重装,统统都不行.... 解决方案 http://stackoverflow.com/questions/3253676/

处理The content of the adapter has changed but ListView did not receive a notification异常

istView在更新时报异常: ERROR/AndroidRuntime(15260): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only

ef 通过DbCommandInterceptor 修改数据库连接 添加数据异常

问题描述 ef 通过DbCommandInterceptor 修改数据库连接 添加数据异常 我想实现数据库的读写分离 ef6里面加了DbCommandInterceptor的功能可是修改以后 在添加新数据的时候 抛出异常 "基础提供程序在 Commit 上失败 值不能为 null. 参数名: connection"但是数据已经成功添加那位前辈读到过这个问题呢 请指导 public class EntityCommandInterceptor: DbCommandInterceptor

tomcat启动的问题,报异常

问题描述 tomcat启动的问题,报异常 解决方案 和tomcat没关系.是你web.xml中的配置的servlet加载的时候报错了 解决方案二: 采用flex+struts+spring+hibernate框架,启动tomcat出现异常,寻求解决方法中..... 严重: StandardWrapper.Throwablejava.lang.NullPointerException?at flex.management.BaseControl.getObjectName(BaseControl.

tomcat启动报错-eclipse 启动 tomcat 异常

问题描述 eclipse 启动 tomcat 异常 tomcat: apache-tomcat-7.0.54-windows-x86 绿色版 eclipse: eclipse-jee-luna-R-win32 . eclipse-jee-indigo-SR2-win32 直接在 ${TOMCAT_HOME}/bin 下双击 startup.bat 可以正常启动,无任何问题, 但是在 eclipse 中配置好之后,加入web工程,启动tomcat,就出现了下面的错误信息: Error occurr

myeclipse配置了weblogic,启动服务报异常

问题描述 myeclipse配置了weblogic,启动服务报异常 1C 解决方案 认证没有通过,估计是myeclipse配置weblogic,忘了设置 解决方案二: weblogic用户名密码不对~

使用osgi api启动osgi时,用java -jar命令运行报异常,用eclipse运行正常

问题描述 使用osgi api启动osgi时,用java -jar命令运行报异常,用eclipse运行正常 我使用osgi的api写了osgi框架的启动程序,然后使用java -jar 命令运行这个jar包报空指针异常,我在eclipse中运行一切正常,请问这是为什么呀

java-myeclipse10配置jrebel6因为改动电脑日期报异常

问题描述 myeclipse10配置jrebel6因为改动电脑日期报异常 运行环境:myeclipse10配置jrebel6 问题原因:在myeclise10的tomcat7的jdk下Optional java VM arguments配置上jrebel后加入,在电脑日期是今天2015.10.21下启动tomcat,能正常启动,但是假如电脑日期把今天改为2015.10.06启动tomcat就会抛出一个异常: if (!fromStart && !toEnd) { if (m.compare

java 连接异常-java 启动jdbc 事务报错 嵌套异常

问题描述 java 启动jdbc 事务报错 嵌套异常 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC

分享一个异步任务在遇到IO异常时支持递归回调的辅助方法

public void TryAsyncActionRecursively<TAsyncResult>( string asyncActionName, Func<Task<TAsyncResult>> asyncAction, Action<int> mainAction, Action<TAsyncResult> successAction, Func<string> getContextInfoFunc, Action<E