7 Replies Latest reply on Nov 26, 2002 3:00 PM by Samuel Montgomery-Blinn

    JBoss 3.0.4 CMR Transaction troubles

    Samuel Montgomery-Blinn Newbie

      Code run in servlet:

      BankLocalHome bnkHome = BankUtil.getLocalHome();
      String bnkName = (String) req.getParameter("bank-name");
      BankLocal bank = bnkHome.findByPrimaryKey( bnkName );
      Set accounts = bank.getAccounts();
      Iterator iterator = accounts.iterator();

      The moment I call the "iterator" function on the set, I receive:

      java.lang.IllegalStateException: A CMR collection may only be used within the transction in which it was created
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet.getIdList(RelationSet.java:58)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet.iterator(RelationSet.java:260)

      There is no mention of "transaction" in either my ejb-jar.xml or web.xml descriptors, I had thought that this would mean there would be no transaction support. How do I explicitly turn off this behavior? Or is this simply a bug in JBoss 3.0.4 (Windows 2000, Sun JDK 1.4.1_01)?

      How can I get past this inability to simply iterate over a CMR collection?