rberehoudougou:

You did the same thing.  Your CMP field used a lower case 'd':


  | <cmp-field>
  | <field-name>productId</field-name>
  | </cmp-field> 
  | 

And your primary key class used an upper case 'D':


  |  public String productID; 
  | 

Also, I can't remember if it is a requirement as I replaced all my composite primary 
keys with sequence numbers awhile back when there was a problem with foreign keys in 
primary keys, but it couldn't hurt to add get/set access methods to your primary key 
class.

Sun's tutorial isn't very clear on what a "field" is in this regard, as they later say 
that the CMP bean implements the field with its access methods, but includes the 
instance variable in parenthesis:


  | In the PurchaseOrderBean class, the following access methods define the persistent 
fields (vendorId and productModel) that make up the primary key:
  | 
  |     public abstract String getVendorId();
  |     public abstract void setVendorId(String id);
  |    
  |     public abstract String getProductModel();
  |     public abstract void setProductModel(String name);
  |  (http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/CMP8.html#72960)

Of course, in their PK example, both the instance variable and the access methods are 
public.  The ejb-jar 2.0 DTD is equally vauge, just saying that "the fields of the 
primary key class must be public" needs to be public.  After you get it working with 
access methods, just for kicks, try making the instance variable private and see if 
that breaks it, then post back.  I don't have any code I can try it with, because, 
like I said, I got rid of all my composite primary keys when I upgraded to JBoss 3.0 
and implemented CMR.

It's not exactly related, but Struts actually reads a form bean's access methods, 
allowing you to use private or "calculated" instance data.  You'd think J2EE would do 
the same, but who knows.  



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3836884#3836884

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3836884



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to