Forums Register Login

A CMR collection may only be used within the transction in which it was created

+Pie Number of slices to send: Send
i got the error above when i trying to get the collection size in my java bean.



and this is declared in my EJB:


my relationship in ejb-jar.xml:


any advise pls?
+Pie Number of slices to send: Send
Assuming that you are accessing the entity beans from within a stateless session bean, make the transaction attribute as 'REQUIRED' for all the beans. That way you will be accessing the CMR in the same transaction in which you acquired it in the first place.
+Pie Number of slices to send: Send
I've already set the transaction as "Required"..

+Pie Number of slices to send: Send
How are you accessing the CMR? If its from within a java-bean and not an 'enteprise java bean' (SLSB for eg) then you will run into this error, because you probably are not starting a transaction before accessing the 'entity bean' in your 'java bean'. The entity bean , since it has a transaction attribute of 'required' will start a new trsnactoin. The CMR will be created in that transaction. but you are trying to access that CMR in a 'java-bean' which is NOT in the same transaction.

Enclosing the java bean method in a transaction may fix this issue



or better why dont you access the entity bean from with a SLSB facade as is the norm
+Pie Number of slices to send: Send
i'm accessing the CMR within a java-bean and not the EJB. reason being is my jsp page is reffering to my java-bean. How can i point my jsp page to directly get the value from the EJB?

anyway, i've tried the code u given and it works!! thanks a lot.

another question is, how do i display the collection? it should consists packageId and softwareID in this.packagesSoftware.

i've done something like this but it gives me error:


pls advise. Thanks.
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1940 times.
Similar Threads
Help me out for EJB2.0 CMR fields mapping in XDOCLET.......
2 primary keys??
one-to-one relationship
URGENT HELP in EJB-QL USING WEBLOGIC 8.1
Chapter 7 - HF study group
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:17:56.