The entity bean doesn't update field in database.
I have two entity beans OrgPersonnel and QualificationName. OrgPersonnel has 
field qualificationNameId (N:1 relation).

For these entity beans in jboss.xml file specified different container 
configurations. The OrgPersonnel bean's configuration is 'Instance Per 
Transaction CMP 2.x EntityBean'. The QualificationName bean's configuration is 
'Standard CMP 2.x EntityBean with cache invalidation' but with commit-option 
'D'.
When I am changing OrgPersonnel entity bean then changes affects all fields for 
corresponding record in database except qualificationNameId field, but it was 
changed. I examined the query that Jboss produced and found that field 
qualificationNameId missed in update.

I tried it on JBoss 4.0.3SP1, 4.0.4.GA


  | 2006-08-04 11:35:34,851 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.OrgPersonnelEJB] 
Executing SQL:
  | UPDATE org_personnels SET family_name=?, family_name_prefix=? WHERE 
org_personnel_id=?
  | 

I tried update other entities with similar configurations but all works 
properly.

If I use default configuration 'Standard CMP 2.x EntityBean' for OrgPersonnel 
entity bean then qualificationNameId field appears in update query and changes 
in database.

ejb-jar.xml

  |         <entity>
  |             <ejb-name>OrgPersonnelEJB</ejb-name>
  |             
<local-home>com.usl.smash.data.orgPersonnel.LocalOrgPersonnelHome</local-home>
  |             <local>com.usl.smash.data.orgPersonnel.LocalOrgPersonnel</local>
  |             
<ejb-class>com.usl.smash.data.orgPersonnel.OrgPersonnelBean</ejb-class>
  |             <persistence-type>Container</persistence-type>
  |             <prim-key-class>java.lang.Integer</prim-key-class>
  |             <reentrant>False</reentrant>
  |             <cmp-version>2.x</cmp-version>
  |             <abstract-schema-name>org_personnels</abstract-schema-name>
  |             <cmp-field>
  |                 <field-name>orgPersonnelId</field-name>
  |             </cmp-field>
  | <cmp-field>
  | <field-name>number</field-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>qualificationNameId</field-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>organizationId</field-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>familyName</field-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>familyNamePrefix</field-name>
  | </cmp-field>
  |             <primkey-field>orgPersonnelId</primkey-field>
  |             <query>
  |                 <query-method>
  |                     <method-name>ejbSelectGeneric</method-name>
  |                     <method-params>
  |                         <method-param>java.lang.String</method-param>
  |                         <method-param>java.lang.Object[]</method-param>
  |                     </method-params>
  |                 </query-method>
  |                 <ejb-ql/>
  |             </query>
  |             <query>
  |                 <query-method>
  |                     <method-name>ejbSelectCountGeneric</method-name>
  |                     <method-params>
  |                         <method-param>java.lang.String</method-param>
  |                         <method-param>java.lang.Object[]</method-param>
  |                     </method-params>
  |                 </query-method>
  |                 <ejb-ql/>
  |             </query>
  |         </entity>
  | 
  | <entity>
  | <ejb-name>QualificationNameEJB</ejb-name>
  | 
<local-home>com.usl.smash.data.qualificationName.LocalQualificationNameHome</local-home>
  | <local>com.usl.smash.data.qualificationName.LocalQualificationName</local>
  | 
<ejb-class>com.usl.smash.data.qualificationName.QualificationNameBean</ejb-class>
  | <persistence-type>Container</persistence-type>
  | <prim-key-class>java.lang.Integer</prim-key-class>
  | <reentrant>False</reentrant>
  | <cmp-version>2.x</cmp-version>
  | <abstract-schema-name>qualification_names</abstract-schema-name>
  | <cmp-field>
  | <field-name>qualificationNameId</field-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>name</field-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>standard</field-name>
  | </cmp-field>
  | <primkey-field>qualificationNameId</primkey-field>
  | <query>
  | <query-method>
  | <method-name>ejbSelectGeneric</method-name>
  | <method-params>
  | <method-param>java.lang.String</method-param>
  | <method-param>java.lang.Object[]</method-param>
  | </method-params>
  | </query-method>
  | <ejb-ql/>
  | </query>
  | <query>
  | <query-method>
  | <method-name>ejbSelectCountGeneric</method-name>
  | <method-params>
  | <method-param>java.lang.String</method-param>
  | <method-param>java.lang.Object[]</method-param>
  | </method-params>
  | </query-method>
  | <ejb-ql/>
  | </query>
  | </entity>
  | 
  | <ejb-relationship-role>
  | 
<ejb-relationship-role-name>QualificationName-has-OrgPersonnels</ejb-relationship-role-name>
  | <multiplicity>One</multiplicity>
  | <relationship-role-source>
  | <ejb-name>QualificationNameEJB</ejb-name>
  | </relationship-role-source>
  | <cmr-field>
  | <cmr-field-name>orgPersonnels</cmr-field-name>
  | <cmr-field-type>java.util.Collection</cmr-field-type>
  | </cmr-field>
  | </ejb-relationship-role>
  | <ejb-relationship-role>
  | 
<ejb-relationship-role-name>OrgPersonnel-is-QualificationName</ejb-relationship-role-name>
  | <multiplicity>Many</multiplicity>
  | <cascade-delete/>
  | <relationship-role-source>
  | <ejb-name>OrgPersonnelEJB</ejb-name>
  | </relationship-role-source>
  | <cmr-field>
  | <cmr-field-name>qualificationName</cmr-field-name>
  | </cmr-field>
  | </ejb-relationship-role>
  | </ejb-relation>
  | 

jbosscmp-jdbc.xml

  | <entity>
  | <ejb-name>OrgPersonnelEJB</ejb-name>
  | <table-name>org_personnels</table-name>
  | <cmp-field>
  | <field-name>orgPersonnelId</field-name>
  | <column-name>org_personnel_id</column-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>qualificationNameId</field-name>
  | <column-name>qualification_name_id</column-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>familyNamePrefix</field-name>
  | <column-name>family_name_prefix</column-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>familyName</field-name>
  | <column-name>family_name</column-name>
  | </cmp-field>
  | <cmp-field>
  | <field-name>organizationId</field-name>
  | <column-name>organization_id</column-name>
  | </cmp-field>
  | <query>
  | <query-method>
  | <method-name>ejbSelectGeneric</method-name>
  | <method-params>
  | <method-param>java.lang.String</method-param>
  | <method-param>java.lang.Object[]</method-param>
  | </method-params>
  | </query-method>
  | <dynamic-ql/>
  | </query>
  | <query>
  | <query-method>
  | <method-name>ejbSelectCountGeneric</method-name>
  | <method-params>
  | <method-param>java.lang.String</method-param>
  | <method-param>java.lang.Object[]</method-param>
  | </method-params>
  | </query-method>
  | <dynamic-ql/>
  | </query>
  | </entity>
  | 
  | 
  | <entity>
  | <ejb-name>QualificationNameEJB</ejb-name>
  | <table-name>qualification_names</table-name>
  | <cmp-field>
  | <field-name>qualificationNameId</field-name>
  | <column-name>qualification_name_id</column-name>
  | </cmp-field>
  | <query>
  | <query-method>
  | <method-name>ejbSelectGeneric</method-name>
  | <method-params>
  | <method-param>java.lang.String</method-param>
  | <method-param>java.lang.Object[]</method-param>
  | </method-params>
  | </query-method>
  | <dynamic-ql/>
  | </query>
  | <query>
  | <query-method>
  | <method-name>ejbSelectCountGeneric</method-name>
  | <method-params>
  | <method-param>java.lang.String</method-param>
  | <method-param>java.lang.Object[]</method-param>
  | </method-params>
  | </query-method>
  | <dynamic-ql/>
  | </query>
  | </entity>
  | 
  | <ejb-relation>
  | <ejb-relation-name>QualificationName - OrgPersonnel</ejb-relation-name>
  | <ejb-relationship-role>
  | 
<ejb-relationship-role-name>QualificationName-has-OrgPersonnels</ejb-relationship-role-name>
  | <key-fields>
  | <key-field>
  | <field-name>qualificationNameId</field-name>
  | <column-name>qualification_name_id</column-name>
  | </key-field>
  | </key-fields>
  | </ejb-relationship-role>
  | <ejb-relationship-role>
  | 
<ejb-relationship-role-name>OrgPersonnel-is-QualificationName</ejb-relationship-role-name>
  | <key-fields/>
  | </ejb-relationship-role>
  | </ejb-relation>
  | 

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963118
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to