Re: problem setting 1: n relationship

From: johannes schmidt (e002753..tudent.tuwien.ac.at)
Date: Thu May 22 2003 - 15:01:31 EDT

  • Next message: Andrus Adamchik: "Re: problem setting 1: n relationship"

    the same happens, if i want to delete an object, that was retrieved using a
    ctxt.performQuery(select)! If I delete an object registered with
    ctxt.createAndRegisterNewObject(String) it works perfectly, if i wish to
    delete an object retrieved using performQuery(select) it doesn't work ->
    same exception!

    greetz, johannes
    ----- Original Message -----
    From: "Andrus Adamchik" <andru..bjectstyle.org>
    To: <cayenne-use..bjectstyle.org>
    Sent: Thursday, May 22, 2003 5:25 PM
    Subject: Re: problem setting 1: n relationship

    > This is something I recenly have been working on. Let me take a look at
    > this tonight.
    >
    > Andrus
    >
    >
    >
    > > i'm using mysql 4.0.7-gamma-nt, jdk-version 1.4.1_02-b06,
    > > jdbc-driver:mysql-connector-java-3.0.6-stable-bin.jar
    > > that's what the object looks like after retrieving it from the database:
    > > (System.out.println)
    > > {[ Adresse => (org.objectstyle.cayenne.access.ToManyList)
    > > PLZ => -956712157
    > > Name => hornsupertown
    > > ]<oid: akj.database.cayenneDataObjects.PLZ: <PLZ: -956712157>; state:
    > > committed>}
    > >
    > >
    > > stack-trace:
    > >
    > > WARN DefaultOperationObserver: Query exception:
    > > org.objectstyle.cayenne.query.SelectQuery
    > >
    > > java.lang.IllegalStateException: An attempt to use uninitialized
    > > DataObjectMatchTranslator: [attributes: null, values: {PLZ=-956712157}]
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.DataObjectMatchTranslator.keys(DataObje
    > > ctMatchTranslator.java:135)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.QualifierTranslator.appendObjectMatch(Q
    > > ualifierTranslator.java:167)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.QualifierTranslator.endBinaryNode(Quali
    > > fierTranslator.java:317)
    > >
    > > at
    > >
    org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(Expressio
    > > nTraversal.java:129)
    > >
    > > at
    > >
    org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(Expressio
    > > nTraversal.java:84)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.QualifierTranslator.doTranslation(Quali
    > > fierTranslator.java:111)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString(Select
    > > Translator.java:142)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.QueryAssembler.createStatement(QueryAss
    > > embler.java:136)
    > >
    > > at org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:386)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:290)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:494
    > > )
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:8
    > > 24)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:881
    > > )
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:753
    > > )
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.util.RelationshipDataSource.updateListData(Re
    > > lationshipDataSource.java:94)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.ToManyList.getObjectList(ToManyList.java:113)
    > >
    > > at org.objectstyle.cayenne.access.ToManyList.add(ToManyList.java:121)
    > >
    > > at
    > >
    org.objectstyle.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.
    > > java:327)
    > >
    > > at
    > >
    org.objectstyle.cayenne.CayenneDataObject.setReverseRelationship(CayenneData
    > > Object.java:404)
    > >
    > > at
    > >
    org.objectstyle.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.j
    > > ava:375)
    > >
    > > at akj.database.cayenneDataObjects._Adresse.setPLZ(_Adresse.java:41)
    > >
    > > at
    > >
    akj.ui.general.dbFieldPanes.adresseDbFieldPane.save(adresseDbFieldPane.java:
    > > 127)
    > >
    > > at akj.ui.Dataframe.btnSave_actionPerformed(Dataframe.java:207)
    > >
    > > at akj.ui.Dataframe.access$3(Dataframe.java:24)
    > >
    > > at akj.ui.Dataframe$5.actionPerformed(Dataframe.java:157)
    > >
    > > at
    > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
    > >
    > > at
    > >
    javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
    > > n.java:1817)
    > >
    > > at
    > >
    javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
    > > 19)
    > >
    > > at
    > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
    > >
    > > at
    > >
    javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
    > > .java:245)
    > >
    > > at java.awt.Component.processMouseEvent(Component.java:5134)
    > >
    > > at java.awt.Component.processEvent(Component.java:4931)
    > >
    > > at java.awt.Container.processEvent(Container.java:1566)
    > >
    > > at java.awt.Component.dispatchEventImpl(Component.java:3639)
    > >
    > > at java.awt.Container.dispatchEventImpl(Container.java:1623)
    > >
    > > at java.awt.Component.dispatchEvent(Component.java:3480)
    > >
    > > at
    > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    > >
    > > at
    > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
    > >
    > > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    > >
    > > at java.awt.Container.dispatchEventImpl(Container.java:1609)
    > >
    > > at java.awt.Window.dispatchEventImpl(Window.java:1590)
    > >
    > > at java.awt.Component.dispatchEvent(Component.java:3480)
    > >
    > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    > >
    > > at
    > >
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
    > > va:197)
    > >
    > > at
    > >
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
    > > :150)
    > >
    > > at
    > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    > >
    > > at
    > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    > >
    > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    > >
    > > WARN DefaultOperationObserver: global exception
    > >
    > > org.objectstyle.cayenne.CayenneRuntimeException: Query exception.
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.util.SelectObserver.nextQueryException(Select
    > > Observer.java:146)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:312)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:494
    > > )
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:8
    > > 24)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:881
    > > )
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:753
    > > )
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.util.RelationshipDataSource.updateListData(Re
    > > lationshipDataSource.java:94)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.ToManyList.getObjectList(ToManyList.java:113)
    > >
    > > at org.objectstyle.cayenne.access.ToManyList.add(ToManyList.java:121)
    > >
    > > at
    > >
    org.objectstyle.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.
    > > java:327)
    > >
    > > at
    > >
    org.objectstyle.cayenne.CayenneDataObject.setReverseRelationship(CayenneData
    > > Object.java:404)
    > >
    > > at
    > >
    org.objectstyle.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.j
    > > ava:375)
    > >
    > > at akj.database.cayenneDataObjects._Adresse.setPLZ(_Adresse.java:41)
    > >
    > > at
    > >
    akj.ui.general.dbFieldPanes.adresseDbFieldPane.save(adresseDbFieldPane.java:
    > > 127)
    > >
    > > at akj.ui.Dataframe.btnSave_actionPerformed(Dataframe.java:207)
    > >
    > > at akj.ui.Dataframe.access$3(Dataframe.java:24)
    > >
    > > at akj.ui.Dataframe$5.actionPerformed(Dataframe.java:157)
    > >
    > > at
    > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
    > >
    > > at
    > >
    javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
    > > n.java:1817)
    > >
    > > at
    > >
    javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
    > > 19)
    > >
    > > at
    > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
    > >
    > > at
    > >
    javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
    > > .java:245)
    > >
    > > at java.awt.Component.processMouseEvent(Component.java:5134)
    > >
    > > at java.awt.Component.processEvent(Component.java:4931)
    > >
    > > at java.awt.Container.processEvent(Container.java:1566)
    > >
    > > at java.awt.Component.dispatchEventImpl(Component.java:3639)
    > >
    > > at java.awt.Container.dispatchEventImpl(Container.java:1623)
    > >
    > > at java.awt.Component.dispatchEvent(Component.java:3480)
    > >
    > > at
    > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    > >
    > > at
    > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
    > >
    > > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    > >
    > > at java.awt.Container.dispatchEventImpl(Container.java:1609)
    > >
    > > at java.awt.Window.dispatchEventImpl(Window.java:1590)
    > >
    > > at java.awt.Component.dispatchEvent(Component.java:3480)
    > >
    > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    > >
    > > at
    > >
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
    > > va:197)
    > >
    > > at
    > >
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
    > > :150)
    > >
    > > at
    > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    > >
    > > at
    > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    > >
    > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    > >
    > > Caused by: java.lang.IllegalStateException: An attempt to use
    > > uninitialized DataObjectMatchTranslator: [attributes: null, values:
    > > {PLZ=-956712157}]
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.DataObjectMatchTranslator.keys(DataObje
    > > ctMatchTranslator.java:135)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.QualifierTranslator.appendObjectMatch(Q
    > > ualifierTranslator.java:167)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.QualifierTranslator.endBinaryNode(Quali
    > > fierTranslator.java:317)
    > >
    > > at
    > >
    org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(Expressio
    > > nTraversal.java:129)
    > >
    > > at
    > >
    org.objectstyle.cayenne.exp.ExpressionTraversal.traverseExpression(Expressio
    > > nTraversal.java:84)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.QualifierTranslator.doTranslation(Quali
    > > fierTranslator.java:111)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString(Select
    > > Translator.java:142)
    > >
    > > at .java:136)
    > >
    > > at org.objectstyle.cayenne.access.DataNode.runSelect(DataNode.java:386)
    > >
    > > at
    > >
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:290)
    > >
    > > ... 38 more
    > >
    > > ----- Original Message -----
    > > From: "Holger Hoffstätte" <holge..izards.de>
    > > To: <cayenne-use..bjectstyle.org>
    > > Sent: Thursday, May 22, 2003 12:24 PM
    > > Subject: Re: problem setting 1: n relationship
    > >
    > >
    > >> johannes schmidt wrote:
    > >> > ..snippety..
    > >> > But when I retrieve the PLZ object from the database using a query
    > >> (see
    > > the
    > >> > code at the end of this mail), I get the following Exception:
    > >> > java.lang.IllegalStateException: An attempt to use uninitialized
    > >> DataObjectMatchTranslator: [attributes: null, values:
    > >> {PLZ=-474230981}]
    > >> >
    > >> > Does anybody know what my problem is all about?
    > >>
    > >> Johannes,
    > >>
    > >> offhand I couldn't see anything too wrong with your code; please post
    > >> some more information about the circumstances of this exception (JDK,
    > >> full stack trace, database + version, JDBC driver version..anything).
    > >> This will help us pinpoint the reason better.
    > >>
    > >> Holger
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu May 22 2003 - 15:00:55 EDT