Return-Path: Delivered-To: apmail-jakarta-cactus-user-archive@apache.org Received: (qmail 62340 invoked from network); 9 Oct 2002 11:25:46 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 9 Oct 2002 11:25:46 -0000 Received: (qmail 8334 invoked by uid 97); 9 Oct 2002 11:26:30 -0000 Delivered-To: qmlist-jakarta-archive-cactus-user@jakarta.apache.org Received: (qmail 8280 invoked by uid 97); 9 Oct 2002 11:26:28 -0000 Mailing-List: contact cactus-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Cactus Users List" Reply-To: "Cactus Users List" Delivered-To: mailing list cactus-user@jakarta.apache.org Received: (qmail 8264 invoked by uid 98); 9 Oct 2002 11:26:28 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <001f01c26f86$a02f4b30$01000001@MOTHY> From: "Tim McAuley" To: Subject: Controlling transactions during unit tests Date: Wed, 9 Oct 2002 12:25:22 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, I am having a trouble with transactions during one of my unit tests, using JBoss 3. Someone might be able to help. I have some code to update a member's interest in a topic. This will retrieve the list of current interests, store them in a cache (separate collection) and update the specified interest when asked to do so (both in the cache and to the db currently). DB Layout: Member 1 - N MemberInterest N - 1 Interest This call will be made through a session bean under normal operation but for the moment I would like to test it separately (using Cactus). Currently I get an exception, with the message: "A CMR collection may only be used within the transaction in which it was created" This happens when I want to load the list of member interests into a cache. This is done by retrieving the cmr collection and then iterating through it to create a separate collection in cache. How can I get this to run within the same transaction using cactus, like it would under normal operation using a session bean (I presume)? I have tried this code (within the unit test) but it does not seem to help: uTrans = (UserTransaction)new InitialContext().lookup("UserTransaction"); uTrans.begin(); // Create the action... which will create the interest cache on first call interestAction = new UpdateInterestAction(memberContext, interest, value); uTrans.commit(); This is the only reference I could find on the web to a similar problem... and suggesting to make sure to run everything within a usertransaction. http://www.jboss.org/forums/thread.jsp?forum=46&thread=20507&message=3738688 #3738688 I am using JBoss 3.0.2 (and 3.0.3), on Win 2K, accessing Postgres 7.1.3 Many thanks, Tim -- To unsubscribe, e-mail: For additional commands, e-mail: