I think I understand the problem now.
I'm not sure how to do what you need using pure CMR. The problem seems to be that you need to specify a compound key for the weblogic.target-column-map, and I don't know how to do it.
(Perhaps a CMR expert could chime in here...)
You may want to consider using ejbSelects. Here is how you could get a Business Line:
--------------------------------
public BusinessLineLocal findBusinessLine() { return ejbSelectBusinessLine(this.getApplicationId()) }
/**
* @ejb:select query="SELECT OBJECT(product) FROM Product product WHERE
* product.applicationId=?1 and product.productType='BUS_LINE'"
*/
public BusinessLineLocal ejbSelectBusinessLine(int applicationId) throws FinderException;
--------------------------------
And then you could do something similar for all of the other products.
I think this will work, but I'm not sure if it's practical for you or not.
[EMAIL PROTECTED] wrote:
Here is our CreditApplicationBean relationships pasted below. I have this relationship for products to a credit application:
creditApplication (1) |--->BusinessCard (0..1) |--->BusinessLine (0..1) |--->ExpressEquity (0..1) |--->SecuredCard (0..1)
Now, When I save a CA, there must be at least 1 product and a max of 4 products as you can see. So, saving is not an issue at all. So if I save 1 BusinessCard to this credit application, then try to findByPromaryKey to get the credit application again, I get a businessCard object in each of the 4 product relationships. But they all are the same object.
Here is my db table and what the data is when I do the find by:
--------------------------------------------------------------- |productPk | applicationId | productType | ....other data ... | --------------------------------------------------------------- | 123 | 987 | BUS_CARD | ...................| ---------------------------------------------------------------
So every product relationship find a productPK and a applicationId as it does not take into account the productType.
Here is what the table could look like: --------------------------------------------------------------- |productPk | applicationId | productType | ....other data ... | --------------------------------------------------------------- | 123 | 987 | BUS_CARD | ...................| --------------------------------------------------------------- | 345 | 987 | BUS_LINE | ...................| --------------------------------------------------------------- | 456 | 987 | SEC_CARD | ...................| --------------------------------------------------------------- | 567 | 987 | EQUIP_EXP | ...................| ---------------------------------------------------------------
========================================================================================= /** * Get BusinessCard product for this CreditApplication. * This is a one (CreditApplication) to one (BusinessCard) relationship. * We can get a BusinessCardDto in the creditApplicationDto.getBusinessCard() method. * We can also setBusinessCard( pBusinessCard ) * * @ejb.interface-method view-type="local" * * @ejb.value-object * compose="com.wf.bd.ice.product.BusinessCardDto" * compose-name="BusinessCardDto" * members="com.wf.bd.ice.product.BusinessCardLocal" * members-name="BusinessCard" * relation="external" * * @ejb.relation * name="CreditApplication-BusinessCard" * role-name="CreditApplication-has-BusinessCard" * target-ejb="BusinessCard" * target-role-name="BusinessCard-belongs_to-CreditApplication" * target-cascade-delete="yes" * * TODO: We may be required to add an additional column * to the Business view to support the 1 -- 1 * relationship of the BusinessCard and CreditApplication * * @weblogic.target-column-map * foreign-key-column="applicationId" * key-column="applicationId" */ public abstract com.wf.bd.ice.product.BusinessCardLocal getBusinessCard();
/** * @ejb.interface-method view-type="local" **/ public abstract void setBusinessCard( com.wf.bd.ice.product.BusinessCardLocal pBusinessCardLocal );
/** * Get BusinessLine for this CreditApplication. * This is a one (CreditApplication) to one (BusinessLine) relationship. * We can get a BusinessLineDto in the creditApplicationDto.getBusinessLine() method. * We can also setBusinessLine( pBusinessLine ) * * @ejb.interface-method view-type="local" * * @ejb.value-object * compose="com.wf.bd.ice.product.BusinessLineDto" * compose-name="BusinessLineDto" * members="com.wf.bd.ice.product.BusinessLineLocal" * members-name="BusinessLine" * relation="external" * * @ejb.relation * name="CreditApplication-BusinessLine" * role-name="CreditApplication-has-BusinessLine" * target-ejb="BusinessLine" * target-role-name="BusinessLine-belongs_to-CreditApplication" * target-cascade-delete="yes" * * TODO: We may be required to add an additional column * to the Business view to support the 1 -- 1 * relationship of the BusinessLine and CreditApplication * * @weblogic.target-column-map * foreign-key-column="applicationId" * key-column="applicationId" */ public abstract com.wf.bd.ice.product.BusinessLineLocal getBusinessLine();
/** * @ejb.interface-method view-type="local" **/ public abstract void setBusinessLine( com.wf.bd.ice.product.BusinessLineLocal pBusinessLineLocal );
/** * Get EquipmentExpress for this CreditApplication. * This is a one (CreditApplication) to one (EquipmentExpress) relationship. * We can get a EquipmentExpressDto in the creditApplicationDto.getEquipmentExpress() method. * We can also setEquipmentExpress( pEquipmentExpress ) * * @ejb.interface-method view-type="local" * * @ejb.value-object * compose="com.wf.bd.ice.product.EquipmentExpressDto" * compose-name="EquipmentExpressDto" * members="com.wf.bd.ice.product.EquipmentExpressLocal" * members-name="EquipmentExpress" * relation="external" * * @ejb.relation * name="CreditApplication-EquipmentExpress" * role-name="CreditApplication-has-EquipmentExpress" * target-ejb="EquipmentExpress" * target-role-name="EquipmentExpress-belongs_to-CreditApplication" * target-cascade-delete="yes" * * TODO: We may be required to add an additional column * to the Business view to support the 1 -- 1 * relationship of the EquipmentExpress and CreditApplication * * @weblogic.target-column-map * foreign-key-column="applicationId" * key-column="applicationId" */ public abstract com.wf.bd.ice.product.EquipmentExpressLocal getEquipmentExpress();
/** * @ejb.interface-method view-type="local" **/ public abstract void setEquipmentExpress( com.wf.bd.ice.product.EquipmentExpressLocal pEquipmentExpressLocal );
/** * Get SecuredCard for this CreditApplication. * This is a one (CreditApplication) to one (SecuredCard) relationship. * We can get a SecuredCardDto in the creditApplicationDto.getSecuredCard() method. * We can also setSecuredCard( pSecuredCard ) * * @ejb.interface-method view-type="local" * * @ejb.value-object * compose="com.wf.bd.ice.product.SecuredCardDto" * compose-name="SecuredCardDto" * members="com.wf.bd.ice.product.SecuredCardLocal" * members-name="SecuredCard" * relation="external" * * @ejb.relation * name="CreditApplication-SecuredCard" * role-name="CreditApplication-has-SecuredCard" * target-ejb="SecuredCard" * target-role-name="SecuredCard-belongs_to-CreditApplication" * target-cascade-delete="yes" * * TODO: We may be required to add an additional column * to the Business view to support the 1 -- 1 * relationship of the Banker and CreditApplication * * @weblogic.target-column-map * foreign-key-column="applicationId" * key-column="applicationId" */ public abstract com.wf.bd.ice.product.SecuredCardLocal getSecuredCard();
/** * @ejb.interface-method view-type="local" **/ public abstract void setSecuredCard( com.wf.bd.ice.product.SecuredCardLocal pSecuredCardLocal );
------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user