This content has been marked as final.
Show 3 replies
-
1. Re: CMR collections access from web-tier
redbeard15 Mar 23, 2006 3:10 PM (in response to zak4899)i'm not sure how you're exactly accessing the various beans n methods, but you mention something that will point to the solution:
Calling the CMR method getAddenda() that returns the Set works
perfectly from another bean, but I would like to call it from custom
JSP tags in the web tier of the same server. When I try this, I get the
following exception:
The act of instantiating a collection of related objects and then retrieving the value objects from that collection must be done in the same transaction.
I suspect that when you call the 'getAddenda()' method from another bean, the methods on that bean require a transaction. You can check your configuration for this.
However, I'm not sure, but I suspect that servlets (e.g., JSP pages) do not wrap entire methods in a transaction. You'll have to do this yourself.
I was running into the same sort of problem running JunitEE tests. I had to augment my JunitEE tests with something like the following (code example not complete):Context ic = new InitialContext(); tx = (UserTransaction) ic.lookup ("java:comp/UserTransaction"); tx.begin(); AccountLocal lObj = home.findByPrimaryKey(objKey); AccountValue vObj = lObj.getAccountValue(); tx.commit();
this is because I had created value objects for another bean (1:n) related to Account. sooo, the 'getAccountValue()' method also retrieves value objects for the Account children, all in one method call. -
2. Re: CMR collections access from web-tier
jelevy01 Mar 23, 2006 5:24 PM (in response to zak4899)RB,
Thank you for your reply, except that I haven't deployed my application yet :(.
I am just tring to get JBoss up w/o exceptions.
J -
3. Re: CMR collections access from web-tier
jelevy01 Mar 23, 2006 5:26 PM (in response to zak4899)Ignore above, wrong thread.