Change Notes item #420746, was updated on 2001-05-02 09:08 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=381174&aid=420746&group_id=22866 Category: None Group: None Status: Open Priority: 5 Submitted By: Vincent Harcq (vharcq) Assigned to: Nobody/Anonymous (nobody) Summary: CMP 1.1 Dependant value obejcts Initial Comment: Some feature were added to the way "dependant value objects" are mapped to table fields. This is for example when I have a UserBean cmp entity bean that have a cmp-field address of non primitive type Address, and I want to store each fields of Address into the database using a specific Jaws feature. IMHO, with dependant objects being dropped of EJB 2.0, I think this feature is important because the standard way to that with ejb 2.0 would be to define a cmp bean for my value object which is really going too far. Up to now, this was possible with the fields of Address being public. This is still possible and needed in the special case the dependant value object is a PrimaryKey class of another enity bean. (IMHO, this is a nice feature to make relationships between ejb without having do use a remote interface field because it permits direct sql between tables, and keep an OO relationship that you loose if you map the pk fields as primtive type. >From now it is also possible when the fields of Address are private, have corresponding get/set methods, if Address have a no argument constructor, and if Address is serializable. As it is my first commit to jboss, I would like that somebody validate my work. Let me know of problems and I'll fix them directly. I also read that somebody have begin to document this feature, I would like to add this in his document and commit the all to jboss- docs. Keep me inform please. The preferred way to do it is this: 1. Define address in the cmp bean : public Address address; 2. Define the dependant value Object that must have a no argument constructor. public class Address implements Serializable { private String line1; private String zipCode; // etc... public Address() {} public String getLine1() { return line1; } public void setLine1(String line1) { this.line1 = line1; } // etc... } 3. in ejb-jar, define address as a field <cmp-field><field-name>address</field- name></cmp-field> 4. in jaws, define how to compose/decompose this dependant value object to database fields, for example : <cmp-field> <field-name>address.line1</field-name> <column-name>addr_line1</column-name> </cmp-field> <cmp-field> <field-name>address.zipCode</field- name> <column-name>addr_zip</column-name> </cmp-field> Be carefull here that the fields that are not mapped will not be taken into account. I had to choose between this and an automatic mapping feature. IMHO, an automatic mapping feature is not necessary and could cause problem/confusion. To finish, you have to know that it is recursive, you can so have for example address.zipCode.code with a Zip object. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=381174&aid=420746&group_id=22866 _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development