Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / January 2005

Tip: Looking for answers? Try searching our database.

CMR collections access from web-tier

Thread view: 
blu4899 - 24 Jan 2005 18:28 GMT
Hi,

I've set up a straightfroward one-to-many CMR relationship with two
Entity Beans on JBoss 4 (XDoclet declarations at the end of this post).
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:
A CMR collection may only be used within the transction in which it was
created

What do I have to do to call this method from the web tier? A sample
would be great.

Could you point me to documentation explaining this CMR restriction?

Thanks,
blu

In bean Project:
/**
* @ejb.interface-method
*
* @ejb.relation
*   name="Project-Addenda"
*   role-name="Project-has-many-Addenda"
*   target-ejb="Addendum"
*   target-role-name="Addendum-belongs-to-Project"
*/
public abstract Set getAddenda();

In bean Addendum:
/**
* @ejb.interface-method
*
* @ejb.relation
*   name="Project-Addenda"
*   role-name="Addendum-belongs-to-Project"
*   target-ejb="Project"
*   target-role-name="Project-has-many-Addenda"
*   cascade-delete="yes"
*
*  @jboss.relation
*      related-pk-field="planKey"
*      fk-column="plan_key"
*      fk-constraint="false"
*/
   public abstract ProjectLocal getProject();
Marek Lange - 26 Jan 2005 09:37 GMT
> Hi,
>
[quoted text clipped - 11 lines]
>
> Could you point me to documentation explaining this CMR restriction?

You have to use value objects since the cmr instance can't be used
outside your transaction. Look at the EJB spec where this restriction is
explained.

-marek


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.