I'm running: - JBoss 3.2.3 - Xdoclet 1.2.1 - MySQL 4.0.21 - Linux RedHat 9
I have what seems to be a rather classic data model: Items: - itemId - price - cost - size - productId Products: - productId - name - desc - categoryId Category: - categoryId - name - desc A category consists of a number of products, a product consists of a number of (individual) items. I also need composite keys on the DB tables (to guard against rows containing the same ID value). For 'Item' table, composite key is 'itemId-productId', for 'Products' table, key is 'productId-categoryId'. I have CMP beans for each and I can get the relationship set (and working!) between Items and Products (But products with only 'productId' as PK). It seems that I have to specify a CMP field (in my ItemBean) for the 'productId' in order to get the 'ItemPK' class generated with a composity key. My (abbrieviated) Xdoclet tags for ItemBean look like: /** Class tag * @ejb.bean name="Item" type="CMP" view-type="local" * schema="Item" cmp-version="2.x" */ public abstract class ItemBean implements EntityBean { /** * @ejb.pk-field * @ejb.persistence column-name="itemId" * @ejb.interface-method * @ejb.transaction type="Supports" */ public abstract String getItemId( ); public abstract void setItemId( String ItemId ); /** * @ejb.pk-field * @ejb.persistence column-name="productId" * @ejb.interface-method * @ejb.transaction type="Supports" */ public abstract String getProductId( ); public abstract void setProductId( String ProductId ); /** * @ejb.interface-method * @ejb.relation name="product-items" * role-name="item-belongs_to-product" * cascade-delete="yes" * * @jboss.relation * fk-column="productId" * related-pk-field="productId" * fk-contraint="true" * */ public abstract ProductLocal getProduct( ); public abstract void setProduct( ProductLocal product ); . } My ProductBean class looks similar (with field names changed, of course). If I just specify a single '@ejb.pk-field' (on productId) in the ProductBean, I can get the Item/Product stuff work just fine. However, when I add the 'categoryId' CMP field (e.g., add another '@ejb.pk-field' for the 'categoryId') the deployment fails. It seems I need to add this 'ejb.pk-field' in the ProductBean to get a composite key generated in the ProductPK class (productId-categoryId composite key). Here's what JBoss says when I try to deploy this set of beans: 2004-10-21 15:06:07,142 INFO [org.jboss.ejb.EjbModule] Deploying Item 2004-10-21 15:06:07,177 INFO [org.jboss.ejb.EjbModule] Deploying Product 2004-10-21 15:06:08,023 ERROR [org.jboss.ejb.EntityContainer] Starting failed org.jboss.deployment.DeploymentException: Mappings were not provided for all fields: unmaped fields=[categoryId] in role=product-has-items Wha? Why would the 'product-has-items' relationship care about the 'categoryId' field? Is there a simple solution? Thanks, R View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852265#3852265 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852265 ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user