-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Help!hilo can't generate id?! fetch out of sequence?!!
PostPosted: Wed Dec 22, 2004 10:25 pm 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
2.1.6

<hibernate-mapping package="com.digitalchina.gx.common.bean">
<class name="SysLogging" table="sys_logging">
<id
column="logging_id"
name="id"
type="long"
>
<generator class="hilo" />
</id>
<property
column="logintime"
length="23"
name="logintime"
not-null="false"
type="timestamp"
/>
<property
column="loginname1"
length="50"
name="loginname1"
not-null="false"
type="string"
/>
<property
column="name1"
length="50"
name="name1"
not-null="false"
type="string"
/>
<property
column="loginip"
length="50"
name="loginip"
not-null="false"
type="string"
/>
<property
column="ifsuccess"
length="1"
name="ifsuccess"
not-null="false"
type="string"
/>
</class>
</hibernate-mapping>


Session s=HibernateUtil.currentSession();
Transaction tx=s.beginTransaction();
SysLogging log=new SysLogging();

log.setLogintime(new java.util.Date());
log.setName1("guojian");
log.setLoginip("127.0.0.2");
log.setIfsuccess("Y");
Integer logID=(Integer)s.save(log);
out.println("Successful,Saving iD : "+logID);

tx.commit();
HibernateUtil.closeSession();


10:01:03,625 WARN [JDBCExceptionReporter] SQL Error: 1002, SQLState: 72000
10:01:03,625 ERROR [JDBCExceptionReporter] ORA-01002: fetch out of sequence
10:01:03,625 ERROR [JDBCExceptionReporter] Could not save object
java.sql.SQLException: ORA-01002: fetch out of sequence
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:1198)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
a:2400)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:2672)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
dStatement.java:527)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery
(WrappedPreparedStatement.java:289)
at net.sf.hibernate.id.TableGenerator.generate(TableGenerator.java:93)
at net.sf.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.ja
va:59)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(Session
Impl.java:765)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at org.apache.jsp.Momory_jsp._jspService(Momory_jsp.java:60)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
95)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
at com.digitalchina.gx.tjgua.util.HiberFilter.doFilter(HiberFilter.java:
74)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.jboss.web.catalina.security.JBossSecurityMgrRealm.invoke(JBossSec
urityMgrRealm.java:227)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
509)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
3)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:619)
at java.lang.Thread.run(Thread.java:534):


Oracle 10g

No SQL :

INFO


Hi friends !

There is a urgent problem I need have to solved now. I use JBoss and oracle 10g. I want to use Oracle10g 's connection pool. (Not XA)

My oracle-service.xml is the following:
Code:
  <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=OracleDS">


   
    <!--uncomment out this line if you are using the OracleDbRealm above
    <attribute name="SecurityDomainJndiName">OracleDbRealm</attribute>
    -->

    <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->
      <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=OracleDS">

        <attribute name="JndiName">OracleDS</attribute>

        <attribute name="ManagedConnectionFactoryProperties">
          <properties>
            <config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin:@192.168.40.202:1521:tjdb</config-property>
                       <config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property>
            <!--set these only if you want only default logins, not through JAAS -->
            <config-property name="UserName" type="java.lang.String">tjgua</config-property>
            <config-property name="Password" type="java.lang.String">tjgua</config-property>
          </properties>

        </attribute>   

<!--Below here are advanced properties -->
        <!--hack-->
        <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends>
      </mbean>
    </depends>

    <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->
      <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=LocalTxPool,name=OracleDS">

        <attribute name="MinSize">0</attribute>
        <attribute name="MaxSize">50</attribute>
        <attribute name="BlockingTimeoutMillis">5000</attribute>
        <attribute name="IdleTimeoutMinutes">15</attribute>
        <!--criteria indicates if Subject (from security domain) or app supplied
            parameters (such as from getConnection(user, pw)) are used to distinguish
            connections in the pool. Choices are
            ByContainerAndApplication (use both),
            ByContainer (use Subject),
            ByApplication (use app supplied params only),
            ByNothing (all connections are equivalent, usually if adapter supports
              reauthentication)-->
        <attribute name="Criteria">ByContainer</attribute>
      </mbean>

    </depends>
    <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
   
    <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>

    <attribute name="TransactionManager">java:/TransactionManager</attribute>

    <!--make the rar deploy! hack till better deployment-->
    <depends>jboss.jca:service=RARDeployer</depends>

  </mbean>


My hibernate.properties is this:
Code:
hibernate.connection.datasource java:/OracleDS


I use hilo to generate id!
I write the code to a jsp to test the connection pool.But JBoss throw exception:ORA-01002: fetch out of sequence?!! No data was inserted into database! But I can update a record using "session.update(log)" If I use Tomcat DBCP connection pool, all is well and I can insert data into database. But I change the oracle 's classes12.jar to inet's jdbc driver,it also report the same error. So I think it is not the problem of jdbc driver.
Why? :(
It seems that hilo can't generate ID and get id to insert data.
How to solve it ? I will waiting here , Thks!

_________________
You are not alone...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 22, 2004 11:51 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
You try make test for insert without JBoss, but with hibernate and hilo
I think that JBoss do any update yet (this error is or read after last row ; save after commit and like)
Your code don't do it and it is probably Jboss, I don't know JBoss for more help

regards
Peco


Top
 Profile  
 
 Post subject: :(
PostPosted: Thu Dec 23, 2004 12:07 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
snpesnpe wrote:
You try make test for insert without JBoss, but with hibernate and hilo
I think that JBoss do any update yet (this error is or read after last row ; save after commit and like)
Your code don't do it and it is probably Jboss, I don't know JBoss for more help

regards
Peco


Without JBoss??

No, I test my application in the JBoss and hibernate as ORM. I mean that I run the jsp in the directory:
C:\eclipse213\jboss-3.0.8_tomcat-4.1.24\server\default\deploy\myapp.war\testHilo.jsp

_________________
You are not alone...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 23, 2004 12:35 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I think that You need find what is problem : hibernate or JBoss .I think that it is JBoss

I don't think that you leave Jboss, only locate problem, but you do what you want

regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 23, 2004 12:54 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
snpesnpe wrote:
I think that You need find what is problem : hibernate or JBoss .I think that it is JBoss

I don't think that you leave Jboss, only locate problem, but you do what you want

regards


Oh,Yes, Thank you snpesnpe. I had misunderstand your meaning.

Now I use uuid.hex to generate ID,it can work. But the id of uuid.hex is string not integer. If I change all the hilo to uuid.hex there can be some bugs in my web application. :(
So I don't want to change the hilo to uuid.hex.

I think the problem maybe JBoss too,is there any autocommit option in JBoss config ?

_________________
You are not alone...


Top
 Profile  
 
 Post subject: :(
PostPosted: Thu Dec 23, 2004 8:12 pm 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
Yashnoo wrote:
snpesnpe wrote:
I think that You need find what is problem : hibernate or JBoss .I think that it is JBoss

I don't think that you leave Jboss, only locate problem, but you do what you want

regards


Oh,Yes, Thank you snpesnpe. I had misunderstand your meaning.

Now I use uuid.hex to generate ID,it can work. But the id of uuid.hex is string not integer. If I change all the hilo to uuid.hex there can be some bugs in my web application. :(
So I don't want to change the hilo to uuid.hex.

I think the problem maybe JBoss too,is there any autocommit option in JBoss config ?


No solution util now. We change the id generator to seqhilo. But it dependence special database. For example,Mysql can't use seqhilo. I also want to know why hilo can't be used in JBOss. Need your help .

_________________
You are not alone...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.