Re: BUG: Sql server Database pk generation ?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Apr 01 2007 - 09:31:39 EDT

  • Next message: Marc Gabriel-Willem: "RE: Cayenne -- Apache automatic deploy problem"

    Hi,

    I don't think there was a change between 1.2.x and 2.0.x in this
    code. The error either means that the database schema in question is
    not setup to support autoincrement, or the driver doesn't support
    autoincremented keys. Are you using the same database and the same
    JDBC driver as before?

    Andrus

    On Mar 31, 2007, at 12:31 PM, Emre YILMAZ wrote:

    > Hi,
    >
    > I set the primary key generation from database(Database generated) by
    > modeller. But I got exception from some tables on Pk generation.
    > This is working well with cayenne 1.2. However cayenne 2.0.2 throws
    > below
    > exception. Can you have any suggestion?
    >
    > Sql server 2005 express edition,Win xp, 1 GB ram, Core due 3 GHz,
    > cayenne
    > 2.0.2
    >
    > Thank you..
    >
    > Exception :
    >
    > 31.03.2007 19:08:53,968 ERROR [AWT-EventQueue-4]
    > (MainFrameController.java:
    > 143) - [v.2.0.2 January 14 2007] One and only one PK row is expected,
    > instead got 0
    > org.apache.cayenne.CayenneRuntimeException: [v.2.0.2 January 14
    > 2007] One
    > and only one PK row is expected, instead got 0
    > at
    > org.apache.cayenne.access.DataDomainFlushObserver.nextGeneratedDataRow
    > s(
    > DataDomainFlushObserver.java:87)
    > at
    > org.apache.cayenne.access.DataNodeQueryAction.nextGeneratedDataRows(
    > DataNodeQueryAction.java:79)
    > at org.apache.cayenne.access.jdbc.BatchAction.processGeneratedKeys(
    > BatchAction.java:265)
    > at
    > org.apache.cayenne.access.jdbc.BatchAction.runAsIndividualQueries(
    > BatchAction.java:208)
    > at org.apache.cayenne.access.jdbc.BatchAction.performAction(
    > BatchAction.java:81)
    > at
    > org.apache.cayenne.dba.sqlserver.SQLServerBatchAction.performAction(
    > SQLServerBatchAction.java:59)
    > at org.apache.cayenne.access.DataNodeQueryAction.runQuery(
    > DataNodeQueryAction.java:59)
    > at org.apache.cayenne.access.DataNode.performQueries
    > (DataNode.java:273)
    > at org.apache.cayenne.access.DataDomainFlushAction.runQueries(
    > DataDomainFlushAction.java:219)
    > at org.apache.cayenne.access.DataDomainFlushAction.flush(
    > DataDomainFlushAction.java:141)
    > at org.apache.cayenne.access.DataDomain.onSyncFlush
    > (DataDomain.java:794)
    > at org.apache.cayenne.access.DataDomain$2.transform
    > (DataDomain.java:765)
    > at org.apache.cayenne.access.DataDomain.runInTransaction
    > (DataDomain.java
    > :820)
    > at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:762)
    > at org.apache.cayenne.access.DataContext.flushToParent
    > (DataContext.java
    > :1226)
    > at org.apache.cayenne.access.DataContext.commitChanges
    > (DataContext.java
    > :1130)
    > at tr.com.htr.hgys.db.base.DbObject.commitChanges(DbObject.java:
    > 249)
    > at tr.com.htr.hgys.db.Title.setName(Title.java:87)
    > at tr.com.htr.hgys.ui.AdditionsModel.saveToDb
    > (AdditionsModel.java:51)
    > at tr.com.htr.hgys.ui.AdditionsPanel.doSave(AdditionsPanel.java:55)
    > at tr.com.htr.hgys.ui.MainFrameController.saveBtnClick(
    > MainFrameController.java:141)
    > at tr.com.htr.hgys.ui.MainFrame$4.actionPerformed(MainFrame.java:
    > 638)
    > at javax.swing.AbstractButton.fireActionPerformed
    > (AbstractButton.java
    > :1995)
    > at javax.swing.AbstractButton$Handler.actionPerformed(
    > AbstractButton.java:2318)
    > at javax.swing.DefaultButtonModel.fireActionPerformed(
    > DefaultButtonModel.java:387)
    > at javax.swing.DefaultButtonModel.setPressed
    > (DefaultButtonModel.java
    > :242)
    > at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
    > BasicButtonListener.java:236)
    > at java.awt.AWTEventMulticaster.mouseReleased
    > (AWTEventMulticaster.java
    > :272)
    > at java.awt.Component.processMouseEvent(Component.java:6038)
    > at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
    > at java.awt.Component.processEvent(Component.java:5803)
    > at java.awt.Container.processEvent(Container.java:2058)
    > at java.awt.Component.dispatchEventImpl(Component.java:4410)
    > at java.awt.Container.dispatchEventImpl(Container.java:2116)
    > at java.awt.Component.dispatchEvent(Component.java:4240)
    > at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java
    > :4322)
    > at java.awt.LightweightDispatcher.processMouseEvent
    > (Container.java:3986)
    > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:
    > 3916)
    > at java.awt.Container.dispatchEventImpl(Container.java:2102)
    > at java.awt.Window.dispatchEventImpl(Window.java:2429)
    > at java.awt.Component.dispatchEvent(Component.java:4240)
    > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    > at org.beryl.gui.WaitCursorEventQueue.dispatchEvent(
    > WaitCursorEventQueue.java:83)
    > at java.awt.EventDispatchThread.pumpOneEventForFilters(
    > EventDispatchThread.java:273)
    > at java.awt.EventDispatchThread.pumpEventsForFilter(
    > EventDispatchThread.java:183)
    > at java.awt.EventDispatchThread.pumpEventsForHierarchy(
    > EventDispatchThread.java:173)
    > at java.awt.EventDispatchThread.pumpEvents
    > (EventDispatchThread.java:168)
    > at java.awt.EventDispatchThread.pumpEvents
    > (EventDispatchThread.java:160)
    > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)



    This archive was generated by hypermail 2.0.0 : Sun Apr 01 2007 - 09:32:09 EDT