1 2 Previous Next 17 Replies Latest reply on May 30, 2004 8:22 AM by erik777 Go to original post
      • 15. Re: MySQL 4/JBoss 3.2.3 and CMP 2.0
        ironbird

        Absolutly right Erik. Thanks you !
        And you solve by the way the error of this topic where rberehoudougou uses a productId cmp field and a productID in its primary key class : the same "d" lower and upper case. Probably a bad natural reflex on the keyboard (the timing for pressing "shift" when you go fast).

        I apologize for not thinking before drawing sometimes. So, don't be severe on me, just call back me to order when i'm in delirium.
        I'm going to scourge myself in the cellar, hopping not reiterate.

        • 16. Re: MySQL 4/JBoss 3.2.3 and CMP 2.0
          aloubyansky

          I do appreciate Ironbird's comments in other threads. Just be careful when and how you post. And think whether you would trust a forum which contained false statements and misleading info.

          • 17. Re: MySQL 4/JBoss 3.2.3 and CMP 2.0
            erik777

            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.



            1 2 Previous Next