-->
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.  [ 2 posts ] 
Author Message
 Post subject: Transaction commit problem
PostPosted: Mon Aug 13, 2012 11:52 am 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Hibernate 4.1.3 or 4.1.6..

I'm have an intractable a problem with a transaction commit...

Here is the code:
Code:
public void saveQuoteLines(List<Ot_rfq_supp_line> lines) {
        Session     session = HibernateUtil.openSession();
        Transaction tx      = null;

        try {
            tx = session.beginTransaction();

            for (Ot_rfq_supp_line line : lines) {
                session.save(line);

                for (Ot_rfq_supp_break suppBreak : line.getBreaks()) {
                    if (suppBreak.getQty_break() != null) {
                        session.save(suppBreak);
                    }
                }
            }
            tx.commit();
        } catch (Exception ex) {
            if (tx != null) {
                tx.rollback();
                log.error(ex.getMessage());
            }
        } finally {
            HibernateUtil.closeSession();
        }
    }


Running the above, I see and error: 16:42:33,387 ERROR SqlExceptionHelper:144 - [LNA][Pervasive][ODBC Engine Interface]Column <PART_NO> not nullable. but elesewhere in log I see : Flushed: 8 insertions, 0 updates, 0 deletions to 8 objects - which suggests all saves were completed..

Trouble is - Column <PART_NO> is NOT defined in any of the tables being saved
Here is the relevant part of the log:
Code:
16:42:33,309 DEBUG SessionImpl:316 - Opened session at timestamp: 13448725533
16:42:33,309 DEBUG AbstractTransactionImpl:158 - begin
16:42:33,309 DEBUG LogicalConnectionImpl:295 - Obtaining JDBC connection
16:42:33,309 DEBUG LogicalConnectionImpl:301 - Obtained JDBC connection
16:42:33,309 DEBUG JdbcTransaction:69 - initial autocommit status: false
16:42:33,324 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,rfq_id,rfq_line_no]{supplier_code=MAC003    , rfq_id=RFQ120813006                    , rfq_line_no=0}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,356 DEBUG SQL:104 -
    select
        currency_."CURRENCY",
        currency_."DESC" as DESC2_12_,
        currency_.PO_RATE as PO3_12_,
        currency_.SO_RATE as SO4_12_,
        currency_.PIK_OF_SALES_VALUE as PIK5_12_,
        currency_.PIK_OF_ITEM_PRICE as PIK6_12_,
        currency_.RESERVED_0447 as RESERVED7_12_,
        currency_.PIC_OF_PURCHASE_VALU as PIC8_12_,
        currency_.PIC_OF_ITEM_COST as PIC9_12_,
        currency_.RESERVED_0448 as RESERVED10_12_
    from
        CURRENCY currency_
    where
        currency_."CURRENCY"=?
16:42:33,371 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,sequence,rfq_id,rfq_line_no]{supplier_code=MAC003    , sequence=0, rfq_id=RFQ120813006                    , rfq_line_no=0}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,371 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,rfq_id,rfq_line_no]{supplier_code=MAC003    , rfq_id=RFQ120813006                    , rfq_line_no=1}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,371 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,sequence,rfq_id,rfq_line_no]{supplier_code=MAC003    , sequence=0, rfq_id=RFQ120813006                    , rfq_line_no=1}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,371 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,rfq_id,rfq_line_no]{supplier_code=STE001    , rfq_id=RFQ120813006                    , rfq_line_no=0}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,371 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,sequence,rfq_id,rfq_line_no]{supplier_code=STE001    , sequence=0, rfq_id=RFQ120813006                    , rfq_line_no=0}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,371 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,rfq_id,rfq_line_no]{supplier_code=STE001    , rfq_id=RFQ120813006                    , rfq_line_no=1}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,371 DEBUG AbstractSaveEventListener:131 - Generated identifier: component[supplier_code,sequence,rfq_id,rfq_line_no]{supplier_code=STE001    , sequence=0, rfq_id=RFQ120813006                    , rfq_line_no=1}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
16:42:33,371 DEBUG AbstractTransactionImpl:173 - committing
16:42:33,371 DEBUG AbstractFlushingEventListener:143 - Processing flush-time cascades
16:42:33,371 DEBUG AbstractFlushingEventListener:183 - Dirty checking collections
16:42:33,371 DEBUG AbstractFlushingEventListener:117 - Flushed: 8 insertions, 0 updates, 0 deletions to 8 objects
16:42:33,371 DEBUG AbstractFlushingEventListener:124 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
16:42:33,371 DEBUG EntityPrinter:114 - Listing entities:
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_line{part_id=070M20-BT-F-070X050-095  , lead_days=null, currency_id=£  , purchase_um=EA, qty_reqd=4.0, reference=null, currency=com.nomogen.jobshop.hibernate.Currency#£  , default_unit_price=0.0, supplier_part_id=null, base_charge=0.0, complete=false, description=70X50MM BRIGHT FLAT BAR 070M20          , minimum_charge=0.0, date_expiry=null, date_effective=null, comments=note                                                                                                                                                                                                    }
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_line{part_id=070M20-BT-F-080X040-095  , lead_days=null, currency_id=£  , purchase_um=EA, qty_reqd=2.0, reference=null, currency=com.nomogen.jobshop.hibernate.Currency#£  , default_unit_price=0.0, supplier_part_id=null, base_charge=0.0, complete=false, description=80X40MM BRIGHT FLAT BAR                 , minimum_charge=0.0, date_expiry=null, date_effective=null, comments=note                                                                                                                                                                                                    }
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_line{part_id=070M20-BT-F-080X040-095  , lead_days=null, currency_id=£  , purchase_um=EA, qty_reqd=2.0, reference=null, currency=com.nomogen.jobshop.hibernate.Currency#£  , default_unit_price=0.0, supplier_part_id=null, base_charge=0.0, complete=false, description=80X40MM BRIGHT FLAT BAR                 , minimum_charge=0.0, date_expiry=null, date_effective=null, comments=note                                                                                                                                                                                                    }
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_break{currency_id=£  , qty_break=1.0, unit_price=0.0, currency=null}
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_break{currency_id=£  , qty_break=1.0, unit_price=0.0, currency=null}
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_break{currency_id=£  , qty_break=1.0, unit_price=0.0, currency=null}
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_line{part_id=070M20-BT-F-070X050-095  , lead_days=null, currency_id=£  , purchase_um=EA, qty_reqd=4.0, reference=null, currency=com.nomogen.jobshop.hibernate.Currency#£  , default_unit_price=0.0, supplier_part_id=null, base_charge=0.0, complete=false, description=70X50MM BRIGHT FLAT BAR 070M20          , minimum_charge=0.0, date_expiry=null, date_effective=null, comments=note                                                                                                                                                                                                    }
16:42:33,371 DEBUG EntityPrinter:121 - com.nomogen.jobshop.hibernate.Ot_rfq_supp_break{currency_id=£  , qty_break=1.0, unit_price=0.0, currency=null}
16:42:33,387 DEBUG SQL:104 -
    insert
    into
        OT_RFQ_SUPP_LINE
        (PART_ID, SUPPLIER_PART_ID, DATE_EFFECTIVE, DATE_EXPIRY, REFERENCE, BASE_CHARGE, MINIMUM_CHARGE, CURRENCY_ID, DEFAULT_UNIT_PRICE, DESCRIPTION, PURCHASE_UM, QTY_REQD, COMMENTS, LEAD_DAYS, COMPLETE, SUPPLIER_CODE, RFQ_ID, RFQ_LINE_NO)
    values
        (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
16:42:33,387 DEBUG SQL:104 -
    insert
    into
        OT_RFQ_SUPP_BREAK
        (QTY_BREAK, UNIT_PRICE, CURRENCY_ID, SUPPLIER_CODE, SEQUENCE, RFQ_ID, RFQ_LINE_NO)
    values
        (?, ?, ?, ?, ?, ?, ?)
16:42:33,387 DEBUG SqlExceptionHelper:139 - [LNA][Pervasive][ODBC Engine Interface]Column <PART_NO> not nullable. [n/a]
java.sql.SQLException: [LNA][Pervasive][ODBC Engine Interface]Column <PART_NO> not nullable.
   at com.pervasive.jdbc.lna.LNAObject.getErrors(LNAObject.java:213)
   at com.pervasive.jdbc.lna.LNAStatement.getErrors(LNAStatement.java:937)
   at com.pervasive.jdbc.lna.LNAObject.checkError(LNAObject.java:256)
   at com.pervasive.jdbc.lna.LNAStatement.execute(LNAStatement.java:310)
   at com.pervasive.jdbc.v2.PreparedStatement.execute(PreparedStatement.java:466)
   at com.pervasive.jdbc.v2.PreparedStatement.executeUpdate(PreparedStatement.java:76)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
   at $Proxy6.executeUpdate(Unknown Source)
   at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:56)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2962)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3403)
   at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
   at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:275)
   at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
   at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
   at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214)
   at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:403)
   at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
   at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
   at com.nomogen.jobshop.dao.Ot_rfqDao.saveQuoteLines(Ot_rfqDao.java:576)
   at com.nomogen.dev.rfq.RFQ.createOt_rfq_supp_lines(RFQ.java:564)
   at com.nomogen.dev.rfq.RFQ.printButtonActionPerformed(RFQ.java:517)
   at com.nomogen.dev.rfq.RFQ.access$200(RFQ.java:39)
   at com.nomogen.dev.rfq.RFQ$3.actionPerformed(RFQ.java:191)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
   at java.awt.Component.processMouseEvent(Component.java:6505)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
   at java.awt.Component.processEvent(Component.java:6270)
   at java.awt.Container.processEvent(Container.java:2229)
   at java.awt.Component.dispatchEventImpl(Component.java:4861)
   at java.awt.Container.dispatchEventImpl(Container.java:2287)
   at java.awt.Component.dispatchEvent(Component.java:4687)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
   at java.awt.Container.dispatchEventImpl(Container.java:2273)
   at java.awt.Window.dispatchEventImpl(Window.java:2719)
   at java.awt.Component.dispatchEvent(Component.java:4687)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
   at java.awt.EventQueue.access$000(EventQueue.java:102)
   at java.awt.EventQueue$3.run(EventQueue.java:662)
   at java.awt.EventQueue$3.run(EventQueue.java:660)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
   at java.awt.EventQueue$4.run(EventQueue.java:676)
   at java.awt.EventQueue$4.run(EventQueue.java:674)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
16:42:33,387  WARN SqlExceptionHelper:143 - SQL Error: 0, SQLState: 23000
16:42:33,387 ERROR SqlExceptionHelper:144 - [LNA][Pervasive][ODBC Engine Interface]Column <PART_NO> not nullable.
16:42:33,387 DEBUG AbstractTransactionImpl:203 - rolling back
16:42:33,387 DEBUG JdbcTransaction:164 - rolled JDBC Connection
16:42:33,387 ERROR Ot_rfqDao:580 - [LNA][Pervasive][ODBC Engine Interface]Column <PART_NO> not nullable.
16:42:33,387 DEBUG JdbcCoordinatorImpl:138 - HHH000420: Closing un-released batch
16:42:33,387  INFO AbstractBatchImpl:207 - HHH000010: On release of batch it still contained JDBC statements
16:42:33,387 DEBUG LogicalConnectionImpl:314 - Releasing JDBC connection
16:42:33,387 DEBUG LogicalConnectionImpl:332 - Released JDBC connection
16:42:33,387 DEBUG ConnectionProxyHandler:219 - HHH000163: Logical connection releasing its physical connection


I'm really not sure how to proceed - my attempts to debug this have thus far (many hours) failed.
Anyone?


Top
 Profile  
 
 Post subject: Re: Transaction commit problem
PostPosted: Mon Aug 13, 2012 12:59 pm 
Regular
Regular

Joined: Sat Apr 23, 2005 7:28 am
Posts: 52
Nevermind...
I found the problem - must be tired - stupid mistake - I had a column PART_NO defined in the OT_RFQ_SUPP_BREAK table. The column was not mapped in hibernate - and I never checked the table.
.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.