I think the problem is with your key-column field. This should be assigned to the
primary key column of your PostalDepot bean, not your PostalPackage bean. So, for
this sample data schema (* = primary key):
postal_depot
-------------
postal_depot_id int *
name varchar
description varchar
postal_package
--------------
postal_package_id int *
name varchar
description varchar
postal_depot_key int
you'd have the following XDoclet tag in PostalPackage:
/**
* @return the postal depot for this package
* @ejb:interface-method view-type="local"
* @ejb:relation
* name="package-postalDepot"
* role-name="one-package-belongs-to-one-postalDepot "
* target-role-name="one-postalDepot-has-many-packages"
* target-ejb="PostalDepot"
* target-multiple="yes"
*
* @weblogic:column-map
* foreign-key-column="postal_depot_id"
* key-column="postal_depot_key"
*/
public abstract PostalDepotLocal getPostalDepot();
/**
* @param postalDepot the postal depot for this package
* @ejb:interface-method view-type="local"
*/
public abstract void setPostalDepot(PostalDepotLocal postalDepot);
The format of the weblogic-cmp-rdbms-jar.xml file looks correct. The ejb-jar.xml file
still has all the standard relationship elements with the multiplicity defined.
WebLogic uses weblogic-cmp-rdbms-jar.xml only to know what database columns to map to
the relationship (which isn't defined in the EJB spec). WebLogic can tie that info
with ejb-jar.xml because the relationship names are the same.
- Adam
-----Original Message-----
From: Hall, Simon {IeS eTech} [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 11:57 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [Xdoclet-user] Many to 1 Unidirection Relationship
Thanks Adam,
The error I get refers to "key-column='POSTAL_DEPOT_KEY'" and that POSTAL_DEPOT_KEY is
not the primary key for PostalPackage. So I changed it to POSTAL_PACKAGE_KEY and it
seemed to like that. I haven't tested it yet though.
Also in weblogic-cmp-rdbms-jar.xml the relationships section does not conform to the
deployment descriptor as I know it. It does not have the multiplicity elements etc,
and it seems that only one side of the relationship is defined. The following is the
generated section for the package-postalDepot relationship:
<weblogic-rdbms-relation>
<relation-name>package-postalDepot</relation-name>
<weblogic-relationship-role>
<relationship-role-name>one-postalDepot-has-many-packages</relationship-role
-name>
<column-map>
<foreign-key-column>POSTAL_DEPOT_KEY</foreign-key-column>
<key-column>POSTAL_PACKAGE_KEY</key-column>
</column-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
Is this correct? I thought it should define the multiplicity of each side of the
relationship? And the <column-map> section looks odd too!
-----Original Message-----
From: Adam Houghton [mailto:[EMAIL PROTECTED]
Sent: 04 November 2003 15:55
To: [EMAIL PROTECTED]
Subject: RE: [Xdoclet-user] Many to 1 Unidirection Relationship
Your XDoclet tags look correct. I've used the exact same tags without any problem.
What is the exact output from the error message you are getting?
Also, in your data schema, make sure you have a POSTAL_DEPOT_KEY column defined in the
table for PackageBean. WebLogic will use this to map the foreign key relationship
between PackageBean and PostalDepotBean.
- Adam
-----Original Message-----
From: Hall, Simon {IeS eTech} [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 9:35 AM
To: '[EMAIL PROTECTED]'
Subject: [Xdoclet-user] Many to 1 Unidirection Relationship
Hello,
I've tried several different combinations of tags to generate a many to 1
unidirectional relationship, but can't get it.
Say I have a two beans, a PackageBean and a PostalDepotBean, and many packages can
belong to one Depot. So I want the PackageBean to know which DepotBean it belongs to
but don't want the DepotBean to know which packages belong to it.
The following is what I curently have as the relationship declaration in the
PackageBean
/**
* @return the postal depot for this package
* @ejb:interface-method view-type="local"
* @ejb:relation
* name="package-postalDepot"
* role-name="one-package-belongs-to-one-postalDepot "
* target-role-name="one-postalDepot-has-many-packages"
* target-ejb="PostalDepot"
* target-multiple="yes"
*
* @weblogic:column-map
* foreign-key-column="POSTAL_DEPOT_KEY"
* key-column="POSTAL_DEPOT_KEY"
*/
public abstract PostalDepotLocal getPostalDepot();
/**
* @param postalDepot the postal depot for this package
* @ejb:interface-method view-type="local"
*/
public abstract void setPostalDepot(PostalDepotLocal postalDepot);
POSTAL_DEPOT_KEY is the primary key of the PostalDepotBean.
This does not work as xdoclet complains that I need a primary key column called
POSTAL_DEPOT_KEY in the PackageBean.
How do I define the PackageBean as the 'many' side of the relationship?
Thanks
Simon Hall
mob: 077 4877 2134
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help
you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
PLEASE NOTE: THE ABOVE MESSAGE WAS RECEIVED FROM THE INTERNET.
On entering the GSI, this email was scanned for viruses by the Government Secure
Intranet (GSI) virus scanning service supplied exclusively by Cable & Wireless in
partnership with MessageLabs.
GSI users see http://www.gsi.gov.uk/main/notices/information/gsi-003-2002.pdf for
further details. In case of problems, please call your organisational IT helpdesk.
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help
you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user