Thank you all for the help. I also figured out the same over the weekend after reading the folling article http://www-128.ibm.com/developerworks/java/library/j-santa1/, which also shows how to solve the problem with light value objects.
Regards, Vang Nguyen Enterprise Application Programmer Department of Emergency Services (61-7) 3247 8586 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Clarance Howatt Sent: Saturday, 20 August 2005 8:12 AM To: [EMAIL PROTECTED] Subject: Re: [Xdoclet-user] n:m mapping Just had another look at this problem and I think the problem is not in your mapping but in XDoclet's handling of m:n relationships in value objects. When you try to get the Organisation value object you get all associated periods and when you get all periods, xdoclet generated code tries to get all the Organisations. The exception that you are seeing is a result of this circular dependency. You could fix it by excluding one of the collections from your value object or changing the XDoclet generated implementation code to check for this circular dependency. Hope this helps Cheers C. Vang Nguyen wrote: >Hi, > >Does any one have a working mapping of a bidirectional n:m relationship that >they could share? I've been trying with various settings with no luck. My >current xdoclet declarations for the relationship between Organsiation and >Period entities are below, but I'm getting the exception listed below the code. > > > /** > * @ejb.relation > * name="Organisation-Period" > * role-name="periods-have-organisations" > * @weblogic.column-map > * key-column="C_ID" > * foreign-key-column="C_PERIOD_ID" > * @weblogic.relation > * join-table-name="MPRS_ORGANISATION_PERIOD_JOIN" > * @ejb.interface-method > * view-type="local" > * @ejb.value-object > * aggregate="au.gov.qld.des.mprs.dto.OrganisationTransferObject" > * aggregate-name="Organisation" > * members="au.gov.qld.des.mprs.ejb.OrganisationLocal" > * members-name="OrganisationLocal" > * relation="external" > * type="java.util.Collection" > */ > public abstract Collection getOrganisations(); > > > /** > * @ejb.relation > * name="Organisation-Period" > * role-name="organisations-have-periods" > * @weblogic.column-map > * key-column="C_ID" > * foreign-key-column="C_ORGANISATION_ID" > * @weblogic.relation > * join-table-name="MPRS_ORGANISATION_PERIOD_JOIN" > * @ejb.interface-method > * view-type="local" > * @ejb.value-object > * aggregate="au.gov.qld.des.mprs.dto.PeriodTransferObject" > * aggregate-name="Period" > * members="au.gov.qld.des.mprs.ejb.PeriodLocal" > * members-name="PeriodLocal" > * relation="external" > * type="java.util.Collection" > * > */ > public abstract java.util.Collection getPeriods(); > >Exception occurred: au.gov.qld.des.mprs.exception.ServiceUnavailableException: >Exception occured getting Financial Years Caused By: >au.gov.qld.des.mprs.exception.ServiceUnavailableException: Error occurred >Caused By: au.gov.qld.des.mprs.exception.ServiceUnavailableException: >Exception converting Caused By: javax.ejb.TransactionRolledbackLocalException: >EJB Exception: ; nested exception is: javax.ejb.EJBException: nested exception >is: javax.ejb.TransactionRolledbackLocalException: EJB Exception: ; nested >exception is: javax.ejb.EJBException: nested exception is: >javax.ejb.TransactionRolledbackLocalException: [EJB:010180]Illegal Reentrant >call to 'Period(Application: mprs-ear-1.0, EJBComponent: mprs-ejb-1.0.jar)' >with primary key: '1'.: weblogic.ejb20.InternalException: [EJB:010180]Illegal >Reentrant call to 'Period(Application: mprs-ear-1.0, EJBComponent: >mprs-ejb-1.0.jar)' with primary key: '1'. at >weblogic.ejb20.manager.BaseEntityManager.checkForReentrant(Ljavax.ejb.EntityBean;Ljava.lang.Object;)V(BaseEntityManager.java:1468) > at >weblogic.ejb20.manager.DBManager.preInvoke(Lweblogic.ejb20.internal.InvocationWrapper;)Ljavax.ejb.EnterpriseBean;(DBManager.java:251) > at >weblogic.ejb20.internal.BaseEJBLocalObject.preInvoke(Lweblogic.ejb20.internal.InvocationWrapper;)Lweblogic.ejb20.internal.InvocationWrapper;(BaseEJBLocalObject.java:228) > at >weblogic.ejb20.internal.EntityEJBLocalObject.preInvoke(Lweblogic.ejb20.internal.MethodDescriptor;Lweblogic.security.service.ContextHandler;)Lweblogic.ejb20.internal.InvocationWrapper;(EntityEJBLocalObject.java:72) > at >au.gov.qld.des.mprs.ejb.Period_a31n8k_ELOImpl.getPeriodTransferObject()Lau.gov.qld.des.mprs.dto.PeriodTransferObject;(Period_a31n8k_ELOImpl.java:514) > at >au.gov.qld.des.mprs.ejb.OrganisationCMP.getOrganisationTransferObject()Lau.gov.qld.des.mprs.dto.OrganisationTransferObject;(OrganisationCMP.java:102) > at >au.gov.qld.des.mprs.ejb.Organisation_smb3qq_ELOImpl.getOrganisationTransferObject()Lau.gov.qld.des.mprs.dto.OrganisationTransferObject;(Organisation_smb3qq_ELOImpl.java:585) > at >au.gov.qld.des.mprs.ejb.PeriodCMP.getPeriodTransferObject()Lau.gov.qld.des.mprs.dto.PeriodTransferObject;(PeriodCMP.java:106) > at >au.gov.qld.des.mprs.ejb.Period_a31n8k_ELOImpl.getPeriodTransferObject()Lau.gov.qld.des.mprs.dto.PeriodTransferObject;(Period_a31n8k_ELOImpl.java:531) > at >au.gov.qld.des.mprs.ejb.MPRSFacadeBean.convertPeriodLocalsToDTOs(Ljava.util.Collection;)Ljava.util.Collection;(MPRSFacadeBean.java:281) > at >au.gov.qld.des.mprs.ejb.MPRSFacadeBean.findFinancialYears()Ljava.util.Collection;(MPRSFacadeBean.java:222) > at >au.gov.qld.des.mprs.ejb.MPRSFacade_vhf35m_EOImpl.findFinancialYears()Ljava.util.Collection;(MPRSFacade_vhf35m_EOImpl.java:154) > at >au.gov.qld.des.mprs.ejb.MPRSFacade_vhf35m_EOImpl_CBV.findFinancialYears()Ljava.util.Collection;(Unknown > Source) at >au.gov.qld.des.mprs.business.MPRSBusinessDelegate.findFinancialYears()Ljava.util.Collection;(MPRSBusinessDelegate.java:83) > at >au.gov.qld.des.mprs.FinancialYearAction.view(Lorg.apache.struts.action.ActionMapping;Lorg.apache.struts.action.ActionForm;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)Lorg.apache.struts.action.ActionForward;(FinancialYearAction.java:43) > at >jrockit.reflect.NativeMethodInvoker.invoke0(Ljava.lang.Object;ILjava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown > Source) at >jrockit.reflect.NativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown > Source) at >jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown > Source) at >java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown > Source) at >org.apache.struts.actions.DispatchAction.dispatchMethod(Lorg.apache.struts.action.ActionMapping;Lorg.apache.struts.action.ActionForm;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;Ljava.lang.String;)Lorg.apache.struts.action.ActionForward;(DispatchAction.java:274) > at >org.apache.struts.actions.DispatchAction.execute(Lorg.apache.struts.action.ActionMapping;Lorg.apache.struts.action.ActionForm;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)Lorg.apache.struts.action.ActionForward;(DispatchAction.java:194) > at >org.apache.struts.actions.MappingDispatchAction.execute(Lorg.apache.struts.action.ActionMapping;Lorg.apache.struts.action.ActionForm;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)Lorg.apache.struts.action.ActionForward;(MappingDispatchAction.java:169) > at >org.apache.struts.action.RequestProcessor.processActionPerform(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;Lorg.apache.struts.action.Action;Lorg.apache.struts.action.ActionForm;Lorg.apache.struts.action.ActionMapping;)Lorg.apache.struts.action.ActionForward;(RequestProcessor.java:419) > at >org.apache.struts.action.RequestProcessor.process(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(RequestProcessor.java:224) > at >org.apache.struts.action.ActionServlet.process(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(ActionServlet.java:1194) > at >org.apache.struts.action.ActionServlet.doGet(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(ActionServlet.java:414) > at >javax.servlet.http.HttpServlet.service(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(HttpServlet.java:740) > at >javax.servlet.http.HttpServlet.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(HttpServlet.java:853) > at >weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:996) > at >weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(ServletStubImpl.java:419) > at >weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(ServletStubImpl.java:315) > at >weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452) > > > >Regards, > >Vang Nguyen > >Enterprise Application Programmer >Department of Emergency Services >(61-7) 3247 8586 > > >This correspondence is for the named persons only. > >It may contain confidential or privileged information or both. > >No confidentiality or privilege is waived or lost by any mis transmission. > >If you receive this correspondence in error please delete it from your system >immediately and notify the sender. > >You must not disclose, copy or relay on any part of this correspondence, if >you are not the intended recipient. > >Any opinions expressed in this message are those of the individual sender >except where the sender expressly, > >and with the authority, states them to be the opinions of the Department of >Emergency Services, Queensland. > > >------------------------------------------------------- >SF.Net email is Sponsored by the Better Software Conference & EXPO >September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices >Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA >Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf >_______________________________________________ >xdoclet-user mailing list >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/xdoclet-user > > ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user This correspondence is for the named persons only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis transmission. If you receive this correspondence in error please delete it from your system immediately and notify the sender. You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. Any opinions expressed in this message are those of the individual sender except where the sender expressly, and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland. ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
