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 );

============================================================================================================================



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
matthew.hawthorne
Sent: Thursday, September 23, 2004 4:22 PM
To: [EMAIL PROTECTED]
Subject: [Xdoclet-user] Re: Help with WLS EJB relationship queries
please. ..


[EMAIL PROTECTED] wrote:
> Ok, when I save a CreditApplication with a BusinessCard (i.e. Product), the
> relationship works fine, and the DB is saved correctly. The issue is getting
> the data back out of the db in a relationship.
> We have 4 products. Each with a productId, applicationId and productType. So
> when we get the Products back out of the db, and there is only 1 product
> saved (not 4), we actually get a BusinessCard returned for each product. It
> is actually the same BusinessCard (productId) for each Product. So it seems
> that the query is not looking for a compound PK (productId & productType)
> which is the query needed to distinguish between each product.


You may want to draw a diagram or something, because I've read this 
paragraph about 10 times and I can't get the terminology straight.

"BusinessCard (i.e. Product)"
"We have 4 products."
"... and there is only 1 product saved..."

I'm having problems understanding your data model, and I'd imagine that 
others may too...


-------------------------------------------------------
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


-------------------------------------------------------
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

Reply via email to