hibernate+oracle使用序列作为主键报错序列不存在 10C

我在数据库中建了一个名为CST_SEQ的序列,然后hibernate的hbm配置如下图,但每次调用save功能时都报错序列不存在,我通过show_sql打印了sql语句之后发现hibernate每次都是执行的select hibernate_sequence.nextval from dual,我的配置文件里面的名称不起作用.只要我在数据库中建立了hibernate_sequence又可以sava成功,请解答
图片说明

0

3个回答

hibernate有主键自增长干嘛还用序列????

0
qq_36682212
qq_36682212 你说的是increment?好像线程不安全
一年多之前 回复


my_seq

加一条参数名,写上你想要的序列名,你可以试试,应该行

0

图片说明
类似这样

0
qq_36682212
qq_36682212 这个试过的,不行
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Hibernate的主键自增序列报错
异常内容:rn[code=java]rnorg.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value; SQL [select T_GAME_GIVING_RECORD_ID_seq.nextval from dual]; nested exception is org.hibernate.exception.SQLGrammarException: could not get next sequence valuern at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:635)rn at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)rn at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:683)rn at com.magus.shframework.daos.impl.BaseDaoImpl.save(BaseDaoImpl.java:45)rn at com.magus.farmgameclient.services.impl.TGameGivingRecordServiceImpl.saveGivingRecord(TGameGivingRecordServiceImpl.java:63)rn at com.magus.farmgameclient.business.impl.GivingRecordBusinessImpl.process(GivingRecordBusinessImpl.java:76)rn at com.magus.farmgameclient.controllers.GameController.givingRecord(GameController.java:418)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:601)rn at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)rn at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)rn at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)rn at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)rn at java.lang.Thread.run(Thread.java:722)rnCaused by: org.hibernate.exception.SQLGrammarException: could not get next sequence valuern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.id.SequenceGenerator.generateHolder(SequenceGenerator.java:128)rn at org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:75)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:705)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:693)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:689)rn at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:686)rn at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:1)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)rn ... 43 morernCaused by: java.sql.SQLSyntaxErrorException: ORA-02289: 序列不存在rnrn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)rn at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)rn at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)rn at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)rn at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)rn at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:205)rn at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:861)rn at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1145)rn at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1267)rn at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)rn at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3493)rn at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)rn at org.hibernate.id.SequenceGenerator.generateHolder(SequenceGenerator.java:108)rn ... 56 morernrn[/code]rn
hibernate中使用oracle的序列作为主键问题
@Id @SequenceGenerator(name="gen",sequenceName="SEQ_ORDER_MAIN" ) @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="gen") @Column(name = "ID", unique = true, nullable = false)按照上面
hibernate使用oracle序列
用户注册的数据放在缓存中,同时放入一个列队里保存到数据库,而现在缓存中没有ID号,这个ID号只能数据保存到数据库中才会产生。我用oracle序列sequence.nextval查询下一个ID号放入缓存,但数据保存前,hibernate又查询了一次sequence.nextval,结果是数据库中ID号增量为2,即上一个是01,下一个就是03了。有没有办法让hibernate插入时不在查询sequence.nextval。或者有什么更好的办法预生成ID号存入缓存。rn望各位指导。
ibatis生成oracle 主键报序列不存在
rnrnrnrn rn rn SELECT STOCKIDSEQUENCE.NEXTVAL AS id FROM DUALrn rn insert into contact (firstName,lastName,email) valuesrn (#firstName#, #lastName#, #email#)rn rn rn rn select * from contactrn rnrnxml文件 rnrnrn SELECT STOCKIDSEQUENCE.NEXTVAL AS id FROM DUALrnrn去了这句话rn插入语句改成rninsert into contact (id,firstName,lastName,email) valuesrn(#id#,#firstName#, #lastName#, #email#)rn则没有问题rn初学ibatisrn请高人指点
Oracle序列和主键映射
前言 每张表都有主键,可分别简单主键和组合主键,简单主键为表中的一列,组合主键为表中的几列。主键的生成策略有许多种,其中,序列是Oracle常见的主键生成策略之一。本文主要讲解JPA映射主键的技术细节。其中,主键生成策略是oracle序列,JPA实现是hibernate。 oracle序列 创建序列 [sql] view plain copy
Oracle之序列(主键自增)
[img]http://dl2.iteye.com/upload/attachment/0097/7648/1a363c2d-b5a4-3029-a2a4-94d8db3d6b6e.jpg[/img] 1. 在Oracle中完成自动增长的功能,则只能依靠序列完成,所有的自动增长操作,需要用户收工完成处理。 序列的创建格式: CREATE SEQUENCE sequence [IN...
oracle序列主键自增长
oracle序列主键自增长实现主键自动增长
Oracle:序列和主键
Oracle①查询数据库所有的序列名称 select * from user_sequences; ②获取表的序列的下一个值 select 序列名.nextval from dual ③获取表的id下一个值 SELECT NVL(MAX(TABLE_ID), 0) + 1 AS tableId FROM IOT_ACM_TABLE;
oracle序列与自增主键
oracle并不像mysql那样提供了自增主键,oracle的自增主键需要通过序列实现。创建序列的语法为CREATR SEQUENCE 序列名称 [INCREMENT BY n] --步长,默认是1[START WITH n] --从几开始,默认是1[MAXVALUE m/MINVALUE n/NOMAXVALUE] --最大值最小值,默认是NOMAXVALUE[CYCLE/NOCYCLE] --...
postgres中用序列作为主键???
意思就是不用每次插入主键,让他每次自动为序列的值。。rn
序列作为主键使用的原理、优缺点讨论
这几天和同事一直在讨论关于表设计中主键选择的问题,用sequence作为主键究竟有什么好处,又有什么缺点,尤其是有些事务场景上下文需要用到创建的序列值,如何用?以下是总结摘要,如有疏漏,还请过路的各位大侠赐教。 1、首先说下seq.nextval主要有以下两种使用场景:(1). 如果一个事务中只是INSERT时需要序列,其他地方不会需要这个序列,那么只需要在INSERT ... VALUES (s
hibernate oracle序列问题
项目使用hibernate做持久化,数据库采用oracle,表主键都采用oracle序列,程序运行一段时间发现好几个表,其id字段居然比序列的nextval大,不知道怎么产生的。每个表主键都是用自己的序列。
【oracle】oracle数据库建立序列、使用序列实现主键自增
2.建立序列 -- Create sequencecreate sequence SEQ_SHIP_IMAGEminvalue 20maxvalue 999999999999999999start with 40increment by 1cache 20; 使用序列: SELECT SEQ_SHIP_IMAGE.Nextval from dual;insert into ship_ima...
ORACLE的ORA-02289: 序列不存在问题
没用过ORACLE,第一次使用,按网上查找的,建立了一个序列SEQ_FOR_ID做自增rnrn使用Navicat工具连接,运行插入SQLrninsert into mytable(ID) values(SEQ_FOR_ID.nextval);rn一切正常rnrn使用JAVA程序与插入,则显示ORA-02289: 序列不存在,什么情况?rnrn我有尝试着让SEQ_FOR_ID.nextval与表中已有数据的ID重复,结果会显示“违反唯一性约束”,按这提示来说,貌似是找到了序列啊?rnrn程序生成的SQL,在工具中直接运行,是正常的rn序列的名字,大写,小写,加双引号都试过都是同样的结果rnSELECT * from ALL_SEQUENCESrn可以看到序列是正常的,OWNER和网站用的用户名是一致的rn
oracle创建主键生成序列
主键生成序列 create sequence seq_pcwang_emp start with 1 increment by 1
Hibernate中使用oracle的序列(sequence)生成主键
在oracle中,我们常使用sequence做为表的主键,用Hibernate时需要在hbm.xml中做下配置: <id name="userId" type="java.lang.Long">       <column name="USER_ID" precision="22" scale="0" />       <generat
oracle获取主键使用的哪个序列
如题 能用sql语句知道当前表的主键使用的是哪个序列吗?rn
Oracle使用序列生成主键演示
<p>rn <br />rn</p>rn<p>rn <p>rn 20周年限定一卡通!<span style="color:#337FE5;">可学Java全部课程</span>,仅售799元(原价7016元),<span style="color:#E53333;">还送漫威正版授权机械键盘+CSDN 20周年限量版T恤+智能编程助手!</span>rn </p>rn <p>rn 点此链接购买:rn </p>rn <table>rn <tbody>rn <tr>rn <td>rn <span style="color:#337FE5;"><a href="https://edu.csdn.net/topic/teachercard?utm_source=jsk20xqy" target="_blank">https://edu.csdn.net/topic/teachercard?utm_source=jsk20xqy</a><br />rn</span>rn </td>rn </tr>rn </tbody>rn </table>rn</p>rn<span>&nbsp;</span> rn<p>rn <br />rn</p>rn针对企业开发的主流框架进行讲解,注重理论和实践的结合,课程内容深入源码,讲解深入浅出,每个技术点都配备具有典型性和实用性的案例及代码。使学生具备开发企业级项目的能力,同时针对框架新特性也有讲授,通过这些新功能实用性强、易用性高,可大幅降低 JavaEE 开发的难度,同时有效提升应用开发的优雅性。
Oracle序列+触发器+主键(实现主键自增)
1.SEQUENCE(序列) -- Create sequence create sequence table_name_ID_SEQ minvalue 1 maxvalue 9999999999 start with 1 increment by 1 cache 20; 2.触发器(triggers) CREATE OR REPLACE TRIGGER
如何使用序列生成主键
题目:插入一条用户记录,使用序列生成主键rn请举个例子,最好有代码的
Hibernate通过注解配置Oracle序列
1.创建Oracle序列create sequence seq_id increment by 1 start with 1 maxvalue 999999999;2.在实体类主键的get方法上面添加注解@Id @SequenceGenerator(name=&quot;gen&quot;,sequenceName=&quot;SEQ_ID&quot; ,allocationSize=1) @GeneratedValue(strateg...
hibernate映射oracle 序列问题!!
我oralce数据库表 主键是 两位机构代码+10位自增序列 是varchar2 12位rn我也创建了序列rn生成hibernate映射文件时,由于主键字段是由:两位机构代码+10位自增序列 合成的无法直接设置主键字段为序列。生成映射文件后也没有关于序列的映射文件。请问 这种情况我该怎么生成映射文件,序列是不是不用生成映射文件 hql操作时直接写就可以呢??rn谢谢高手指教!!
hibernate save的时候报错 ORA-02289: 序列(号)不存在
错误如下: rn[code]rnHibernate: select hibernate_sequence.nextval from dualrn2009-07-13 09:17:59,421 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 2289, SQLState: 42000rn2009-07-13 09:17:59,421 ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-02289: 序列(号)不存在rnrn2009-07-13 09:17:59,437 WARN [org.apache.struts.action.RequestProcessor] - Unhandled Exception thrown: class org.springframework.dao.InvalidDataAccessResourceUsageExceptionrn2009-7-13 9:17:59 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet action threw exceptionrnjava.sql.SQLException: ORA-02289: 序列(号)不存在rnrn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)rn at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)rn at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:213)rn at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:796)rn at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1031)rn at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:836)rn at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1124)rn at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)rn at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)rn at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)rn at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:75)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)rn at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:635)rn at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)rn at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:632)rn at com.eway.person.dao.FingerinfoDAO.saveFingerinfo(FingerinfoDAO.java:38)rn at com.eway.person.service.FingerinfoService.saveFingerinfo(FingerinfoService.java:26)rn at com.eway.person.service.FingerinfoService$$FastClassByCGLIB$$35115103.invoke()rn at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)rn at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:695)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)rn at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)rn at com.eway.person.service.FingerinfoService$$EnhancerByCGLIB$$6c5167a9.saveFingerinfo()rn at com.eway.person.action.FingerprintAction.saveFingerPrint(FingerprintAction.java:153)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)[/code]rn这是hibernate的映射rn[code=XML]rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rnrn哪里不对了....请高手,急用谢谢!!
hibernate save() 时 java.sql.SQLException: ORA-02289: 序列不存在
[b]jsp:[/b]rn rn rn 车辆名称:rn rn rn rn rn 项目名称:rn rn rn rn rn rn 厂商rn rn rn rn rn 车型rn rn rn rn rn 类别rn rn rn A类乘用车rn B类乘用车rn 小型乘用车rn MPVrn SUVrn rn rn rn rnrn[b]hibernate: session.save(carInfo);[/b][color=#FF0000]执行到这里时报错如下:[/color]rn[b]报错:[/b]rnorg.hibernate.exception.SQLGrammarException: could not get next sequence valuern at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)rn at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:536)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:524)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:520)rn at dao.CarInfoDao.addCarInfo(CarInfoDao.java:28)rn at service.CarInfoService.addCarInfo(CarInfoService.java:14)rn at action.CarInfoAction.addCarInfo(CarInfoAction.java:48)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:606)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)rn at java.lang.Thread.run(Thread.java:745)rnCaused by: java.sql.SQLException: ORA-02289: 序列不存在rnrn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)rn at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)rn at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)rn at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:810)rn at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)rn at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)rn at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)rn at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)rn at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)rn at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:75)rn ... 77 morern哪出问题了,急等,谢谢!!
请教:动态创建oracle序列,使用时提示序列不存在
在存储过程中动态创建序列,使用时老提示序列不存在。部分代码如下:rn。。。rnselect count(*) into amount from user_sequences where sequence_name='WZ_SEQ';rnif(amount>0) thenrnexecute immediate 'drop sequence WZ_SEQ';rnend if;rnexecute immediate 'create sequence WZ_SEQ start with 1 increment by 1 nominvalue nomaxvalue nocache'; rnrninsert into a(id) select WZ_SEQ .nextval from ...rn...rnrn在执行上述代码前,如果WZ_SEQ存在就不报错,rn如果不存在,执行到insert into 语句就报序列不存在。请高手指点,谢谢!
oracle varchar2序列的使用
create table book( bookId varchar2(4) primary key, name varchar2(20) ); --创建序列 create sequence book_seq start with 1 increment by 1; --创建触发器 create or replace trigger book_trigger before insert on bo...
Oracle之序列的使用
一、首先创建一个oracle的sequence,sql语句如下:create sequence 序列名increment by 1start with 1maxvalue 999999999cycle;(简单的方式:create sequence 序列名 然后点击运行,再edit进入所创的序列修改参数。)二、通过序列名.nextval实现插入时,字段的自增一当向表中插入数据时,SQL语句...
oracle的序列使用注意
oracle使用序列的时候不能和new sysguid()一起使用。
oracle序列使用
1.oracle的序列为我们提供每一条记录的唯一编号,最适合给主键赋值。 (1).创建序列: create sequence student_sequ increment by 1 start with 23050601 maxvalue 23050632 nocycle nocache; 重命名序列:rename  student_sequ  to worker_sequ; (2).创...
oracle中序列的使用
dual (Oracle中的一张内部表) Oracle提供的最小的表,不论进行何种操作(不要删除记录),它都只有一条记录——'X'。是sys用户下的一张内部表,所有用户都可以使用DUAL名称访问,无论什么时候这个表总是存在。 例如:执行select * from dual,里面只有一条记录;执行insert into dual values('Y')后,再次查询...
Oracle 序列 触发器的使用
ORACLE 序列   CREATE SEQUENCE emp_sequence --序列名 INCREMENT BY 1 -- 每次加几个 START WITH 1 -- 从1开始计数 NOMAXVALUE -- 不设置最大值 NOCYCLE -- 一直累加,不循环 CACHE 10 -- 制定存入缓存(也就是内存)序列值的个数; 备注:如果指定CACHE值,ORACLE就可...
oracle中的序列的使用?
------------------------一个例子-----------------------rncreate sequence for_test --序列名 rnincrement by 1 --每次增加1rnstart with 1 --从1开始rnnomaxvalue --没有最大值rnnocache --没有缓存序列rnrn----------------------------创建测试表------------------rncreate table Testrn(rnid number(10) primary key,rnname varchar2(20) not null,rndesc varchar2(200) nullrn)rnrn-----------------------------使用序列-------------------rninsert into Testrnvalues(for_test.nextval,'序列测试','这是一个序列使用的例子')rnrn--------------------序列使用结果查询-----------------rnselect * from testrnrnrn我在插入的时候不想写for_test.nextval 可以吗?rn如:rninsert into Testrnvalues('序列测试','这是一个序列使用的例子')rnrn可以不?rnrn
oracle之序列的使用
序列即sequence,官方英文解释为       A sequence, which is an object from which multiple users may generate unique integers. You can use sequences to automatically generate primary key values.      大概意思是这一个多数用户
jpa使用oracle序列
1
Oracle序列的使用
  创建序列    修改、删除序列  使用 alter 命令进行修改 使用 drop 命令删除   drop sequence SEQ_ORDER     序列的使用  currval 表示序列的当前值,新序列必须使用一次nextval 才能获取到值,否则会报错 nextval 表示序列的下一个值。新序列首次使用时获取的是该序列的初始值,从第二次使用时开始按照设置的步进递增 查询...
怎么使用oracle的序列?
想在oracle中使用access一样的自动编号,建立了序列号怎么加入表的某个字段?不太明白,能给我一个详细的例子吗?rn
oracle序列使用详解
-- 创建序列 create sequence seq_test -- 查询序列的下一个值 select seq_test.nextval from dual -- 查询当前值 select seq_test.currval from dual -- 查询当前序列上一个值 select seq_test. -- 有最大值的非循环序列 create sequence seq_test1 m...
oracle中序列的使用
转载地址: http://www.cnblogs.com/williambirkin/archive/2006/11/22/567898.html
oracle中使用序列
场景:在开发中数据库主键id设计为number类型了,因此不能使用uuid进行随机生成id,那么现在使用oracle的序列自动生成吧。 首先创建序列 create sequence seq_case_studyid minvalue 1  //最小值 maxvalue 999999   //最大值 start with 1  //从几开始 increment by 1;  //增长幅度 创建...
oracle使用序列的问题
我建了一个序列seq!建立一个表表a,表的主键就是这个序列rn我通过seq.nextval为主键向表中插入数据rn1 ……rn2……rn3……rn4……rn5……rn然后我把第二条记录删除了,也就是2…… 这条记录没了 rn当我再次插入数据的时候!rn我如何才能插入2………… 而不是6…………谢谢rnrn注:我在建立序列的时候已经将cycle选项勾上了
相关热词 c# 线程顺序 c#昨天当前时间 c# 多进程 锁 c#mysql图片存取 c# ocx 委托事件 c# 读取类的属性和值 c# out 使用限制 c#获取url的id c#怎么进行分页查询 c# update 集合