Ask Experts Questions for FREE Help !
Ask
    mishrasat3011's Avatar
    mishrasat3011 Posts: 1, Reputation: 1
    New Member
     
    #1

    Jul 11, 2012, 02:52 AM
    Hibernate Transaction commit prevents to lock another record in a loop
    Hi,

    I have a problem with hibernate in my application. I am using a loop for processing records like example below-

    Fetch 10 records
    While()
    {
    Begin transaction
    Lock one record(using session.lock)
    Process this record
    Commit transaction
    }

    Application will run on two or more machines to access one database, this is why lock is important.

    Inside the loop everything is fine in first run, but next time when trying to lock it gets error-

    2012-07-11 05:33:02,361 ERROR [STDERR] net.sf.hibernate.exception.GenericJDBCException: Unable to perform find
    At net.sf.hibernate.exception.ErrorCodeConverter.hand ledNonSpecificException(ErrorCodeConverter.java:90 )
    At net.sf.hibernate.exception.ErrorCodeConverter.conv ert(ErrorCodeConverter.java:79)
    At net.sf.hibernate.exception.JDBCExceptionHelper.con vert(JDBCExceptionHelper.java:29)
    At net.sf.hibernate.impl.SessionImpl.convert(SessionI mpl.java:4131)
    At net.sf.hibernate.impl.SessionImpl.find(SessionImpl .java:3663)
    At net.sf.hibernate.impl.CriteriaImpl.list(CriteriaIm pl.java:238)
    At com.uniteller.switchcore.databroker.DataBroker.fet chUpdateRecord(DataBroker.java:760)
    At com.uniteller.switchcore.databroker.DataBrokerProc essor.processUpdates(DataBrokerProcessor.java:50)
    At com.uniteller.switchcore.databroker.DataBroker.run (DataBroker.java:258)
    Caused by: java.sql.SQLException: ORA-01002: fetch out of sequence

    At oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:168)
    At oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAcce ss.java:1597)
    At oracle.jdbc.oci8.OCIDBAccess.fetch(OCIDBAccess.jav a:1410)
    At oracle.jdbc.driver.OracleStatement.doExecuteQuery( OracleStatement.java:1681)
    At oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:1870)
    At oracle.jdbc.driver.OraclePreparedStatement.execute Update(OraclePreparedStatement.java:363)
    At oracle.jdbc.driver.OraclePreparedStatement.execute Query(OraclePreparedStatement.java:314)
    At org.jboss.resource.adapter.jdbc.WrappedPreparedSta tement.executeQuery(WrappedPreparedStatement.java: 304)
    At net.sf.hibernate.impl.BatcherImpl.getResultSet(Bat cherImpl.java:89)
    At net.sf.hibernate.loader.Loader.getResultSet(Loader .java:880)
    At net.sf.hibernate.loader.Loader.doQuery(Loader.java :273)
    At net.sf.hibernate.loader.Loader.doQueryAndInitializ eNonLazyCollections(Loader.java:138)
    At net.sf.hibernate.loader.Loader.doList(Loader.java: 1063)
    At net.sf.hibernate.loader.Loader.list(Loader.java:10 54)
    At net.sf.hibernate.loader.CriteriaLoader.list(Criter iaLoader.java:118)
    At net.sf.hibernate.impl.SessionImpl.find(SessionImpl .java:3660)
    ... 4 more

Check out some similar questions!

Please prepare journal entry to record the exchange transaction [ 1 Answers ]

XYZ company exchange used truck plus cash for vacant land that might be used for a future plant site. The truck has a value of US$42000 ($64000 less $22000) accumulated depriciation). XYZ's purchasing agent, who has previous dealings in the second hand market,indicates that the truck has a fair...

How to record a transaction [ 2 Answers ]

Hello I am really confused on how to record these transactions: 1. Amortized $60 of the discount on bonds payable. This is how I recorded it: Amortization Expense Debit $60 Discount on Bonds Payable Credit $60 Evidently the amortization expense is in correct. Could you please help?

Journal entry to record in transaction [ 3 Answers ]

July 9th Office Supply Corp delivers furniture ($1,060) and expendable office supplies ($160) to Random Leaving an invoice for $1220. The journal entry to record the July 9th transaction will include a credit of $1,220 to what account?? I’m pretty sure that it’s Accounts...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.