0 Replies Latest reply on Jan 30, 2004 10:25 AM by rchristy63

    3.2.4 problem with 1-to-many relationship

    rchristy63 Newbie

      I wanted to post a second time because I've spent some time debugging and realized my first posting was wrong. I have a server that has been working in past jboss releases fine. Same code base, but with 3.2.4 I'm having problems. I have a bean with a 1-to-many relationship with another bean. Now if once all the beans are in the cache, everything works great. I found out that if I read one bean time by primary, I can cache the server. But in an uncached server reading multiple keys at once, I get the following exception thrown from JDBCCMP2xFieldBridge.java

      throw new IllegalStateException(
      "New value [" + value + "] of a foreign key field "
      + getFieldName()
      + " changed the value of a primary key field "
      + cmpFieldIAmMappedTo.getFieldName()
      + "[" + fieldState.value + "]");

      Tracing through this code, I see the server calling the setInstanceValue() method trying to update the many side bean with the foreign key for the first time. Basically the bean has a null value for this foreign key field and the caller is trying to set it to the correct value. But since the isPrimaryKeyMember() is set to true and the values are different (so the isValueChanged() returns true), it throws the exception. I'm using xdoclet to generate relationships. Here it is

      * @return a collection of identifications
      * @ejb.interface-method
      * @ejb.relation
      * name="identification-security"
      * role-name="security-has-identification"
      * target-ejb="Identification"
      * target-multiple="no"
      * target-role-name="identification-of-security"
      * @jboss:target-relation
      * related-pk-field="securityID"
      * fk-column="SECURITY_ID"
      * @jboss.relation-read-ahead strategy="on-load"

      Is there some mistake here that is causing this behavior in the new release that older releases didn't care about?

      Thanks in advance,