Hi,

Effectively, a collection returned by a getter on a CMR field can only be used within 
the initial transation (created during the EJB getter call).
You should set the transaction type to "required" for your getter method, and test 
your code within this enveloppe:

UserTransaction tx = null; 
InitialContext ctx = null; 
boolean rollback = false; 
try { 
    ctx = new InitialContext(); 
    tx = (UserTransaction)ctx.lookup("UserTransaction"); 
    tx.begin(); 
    // Do your thing 
} catch (Throwable ex) { 
  // Maybe set rollback = true if needed
} finally { 
    try { 
        // Close the InitialContext 
        if (ctx != null) { 
            ctx.close(); 
        } 
        //  Must always remember to commit or rollback. 
        if (tx != null) { 
          if (rollback) { 
        tx.rollback(); 
          } else { 
        tx.commit(); 
          } 
        } 
    } catch (Throwable ex2) { 
        // Big problem if falls there !
    } 
} 

<a 
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823927#3823927";>View 
the original post</a>

<a 
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3823927>Reply 
to the post</a>


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to