Hi,

I am having a trouble with transactions during one of my unit tests. 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 (seperate
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 seperately (using Cactus).

Currently I get an exception, with the message:
"A CMR collection may only be used within the transction in which it was
created"

This happens when I want to load the list of member interests into a cache.
This is done by retrieveing the cmr collection and then iterating through it
to create a seperate 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("java:/comp/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, on Win 2K, accessing Postgres 7.1.3

Many thanks,

Tim



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to