0 Replies Latest reply on Jan 29, 2004 5:32 PM by afm

    CMR one2many bidirectional not working

    afm Newbie

       

      "afm" wrote:
      Hello,

      I've an entity bean which references two other beans via a one2many
      bidirectional CMR relationship. Setting up everything unidirectionally
      was no problem, the Collection based CMR fields return what I expect.
      BTW, I use Integer PKs throughout.

      To turn the unidirectional setup bidirectional, I added a cmr-field element
      to the ejb-relationship-role with the multiplicity Many. I also added
      abstract getOther() and setOther(OtherLocal) methods to the bean
      class and to the Local interface. I did not change jbosscmp-jdbc.xml
      (what would I have to change here?).

      When I now get a local reference using findByPrimaryKey(4) (I know
      that there is an entity for pk=4, and JBoss gives it to me), JBoss throws
      exceptions as soon as I ask the bean for any of its fields:

      java.sql.SQLException: Unable to load to deserialize result: java.io.EOFException

      From the database log I see that the data is read from the database
      (MySQL). None of the other methods is ever called (I've put
      logging statements just about everywhere). I wonder why it should at all
      try to deserialize anything. There are only basic types in the tables.
      BTW, all the primary and foreign keys are properly defined in the
      database.

      I did some research for this problem in the FAQ and the documentation,
      but there aren't that many examples of bidirectional relationsships
      around.

      Thanks for any suggestions what could be wrong.

      Andreas Mueller