0 Replies Latest reply on Mar 24, 2003 4:10 PM by s g

    JBoss loading same table row more than once

    s g Newbie


      I am using JBoss 3.0.6 and CMP for my tables with multi-hop realtions.

      I have a many-to-may relation between a message and attribute.

      But as the association between message and attribute has other fields like the sequence of the attribute in the message, i am modeling this as a one-to-many between message and message-attribute tables and another one-to-many between attribute and message-attribute tables.
      But there is an unique constarint on the message-attibute table for messageid, attributeid. Essentially this means that i cannot have the same attribute in a message more than once.
      In my application i need to get the 2nd attribute in a given message identified by its messageid. (This is the row in the message-attribute table with given messageid and seq_no = 2).

      In my tables i have the following data:
      Message table:
      messageid 1
      messagename msg1

      Attribute table:
      attributeid 1 2
      attributename attr1 attr2

      message-attribute table:
      messageid 1 1
      attributeid 1 2
      seqno 1 2

      Jboss loads all the rows from the message-attribute table with the seq_no 1.

      I get the following exeption when i try to access message.getMessageAttributesWithSeq(1).getAttribute:

      15:53:49,949 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedB
      javax.ejb.EJBException: Data contains multiple values, but this cmr field is sin
      gle valued
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.load(JDBCCMR
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.load(JDBCCMR
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getInstanceV
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getValue(JDB
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke
      at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)

      Any help in this regards would be greatly appreciated.