Another thing that might be an issue is 2 M-N relationships I have.
1 is a:
M (String) -> N (String)
and the other is:
M (Long) -> N (String)
The M-N String relationship saves data to the relationship table, but it
seems to be swapped:
/**
* @ejb.interface-method view-type="local"
*
* @ejb.value-object
* compose="com.wf.bd.ice.account.BankAccountDto"
* compose-name="BankAccountDto"
* members="com.wf.bd.ice.account.BankAccountLocal"
* members-name="BankAccount"
* relation="external"
* type="java.util.Collection"
*
* @ejb.relation
* name="Guarantor-BankAccount"
* role-name="Guarantor-has-BankAccounts"
* target-ejb="BankAccount"
* target-role-name="BankAccount-has-Guarantors"
* target-multiple="yes"
* --target-cascade-delete="yes"
*
* @weblogic.relation join-table-name="T_ICE_GUARANTORACCOUNT_REL"
*
* @weblogic.column-map
* foreign-key-column="bankAccountPK"
* key-column="guarantorPK"
*
* @weblogic.target-column-map
* foreign-key-column="guarantorPK"
* key-column="bankAccountPK"
**/
public abstract Collection getBankAccounts();
/**
* @ejb.interface-method view-type="local"
**/
public abstract void setBankAccounts( Collection pBankAccounts );
When I save this to the Entities, I get this in my table:
T_ICE_GUARANTORACCOUNT_REL
=============================
guarantorPK ||| bankAccountPK
-----------------------------
BankAccStrng ||| Guarstring
=============================
> -----Original Message-----
> From: Harkness, David [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 25, 2004 5:07 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [Xdoclet-user] RE: CMR Issues/Bug? #2
>
>
> [EMAIL PROTECTED] wrote:
> > The rest of the Entities get the PK set at creation time
> > like: setProductPK(
> BusinessCardUtil.generateGUID(pBusinessCardDto) );
>
> productPK is the name of the CMP attribute on BusinessCard? Just
> double-checking that I understand here.
>
> > Yes, I create a new CreditApplicatonDto and populate it with
> > just the core data in the CreditApplication. No other
> > objects. I did try it originally by creating the
> > CreditApplication with the original CreditApplicationDto, but
> > have been desperately trying to hack anything in to get
> this to work.
>
> What happened before when you sent in the CAppDTO with the 3 sub-DTOs
> hanging off of it? XDoclet should have generated code that created the
> sub-DTOs (in ejbPostCreate I guess). Just curious as it may point to
> what's happening here too.
>
> > No, all of my relationships are unidirectional. So i only
> > have CMR declarations in the CreditApplicationBean.
>
> Okay, then are you seeing that in the database the 3 related
> tables have
> app_id set along the way. Meaning, you setBusinessCard, and it has an
> app_id. Then you setBusinessLine and it gets an app_id *and* the
> business card row loses its app_id. What I'm getting at is from where
> are the appIDs disappearing? Just the database or the DTOs or
> somewhere
> else? The other thing to make sure of is that the appID is
> being set and
> then unset. Or is it somehow magically knowing you're adding
> three items
> to the app and only setting the appID for the last one? Unlikely.
>
> If this is happening in the database, I recommend you go grab p6spy.
> It's a JDBC driver-wrapper that will log all of the SQL calls your
> appserver is making. This has helped me so very much during my
> development:
>
> http://www.p6spy.com/download.html
>
> The docs are kinda hazy, so from memory here's all you need to do:
>
> * Put p6spy.jar in your appserver lib/ext
> * Change p6spy.properties to use your driver class name
> * Put p6spy.properties in your appserver directory (in the domain for
> WebLogic)
> * Change the JDBC driver in your ConnectionPool to the p6spy driver
>
> After that, start your appserver and it creates spy.log with
> all the SQL
> commands and result sets. Quite handy.
>
> Anyway, back to the program...
>
> > I am posting the relationship for 1 product as they are all
> > identical,
>
> Identical except for the relation name, role name,
> target-role-name and
> target-ejb (marked == below), right? I suppose if they were the same
> you'd get a deployment (or XDoclet) error.
>
> > I have checked many times. But, there is no way
> > for me to create a BusinessCard with an AppId. I added it
> > once, and got aCMR error. So I had to let the CMR manage the AppId.
> >
> > /**
> > * @ejb.relation
> > == * name="CreditApplication-BusinessCard"
> > == * role-name="CreditApplication-has-BusinessCard"
> > == * target-ejb="BusinessCard"
> > == *
> target-role-name="BusinessCard-belongs_to-CreditApplication"
> > * target-cascade-delete="yes"
> > *
> > * @weblogic.target-column-map
> > * foreign-key-column="applicationId"
> > * key-column="applicationId"
> > */
>
> If this still doesn't help, you can send me the whole
> CreditApplicationEJB source (if you're wary of posting the whole thing
> to the list) as an attachment. I don't know that I'll spot something,
> but I've always found a second pair of eyes to be useful.
>
> David Harkness
> Sr. Software Engineer
> Sony Pictures Digital Networks
> (310) 482-4756
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> digital self defense, top technical experts, no vendor pitches,
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
>
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user