Bug 1009615

Summary: EJB2 CMP Entities are not synchronized to the DB under special circumstances (business logic inside the EntityBean)
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: wfink
Component: EJBAssignee: wfink
Status: CLOSED CURRENTRELEASE QA Contact: Jan Martiska <jmartisk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.1, 6.1.0, 6.1.1CC: jawilson
Target Milestone: ER3   
Target Release: EAP 6.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1010886 (view as bug list) Environment:
Last Closed: 2013-12-15 16:55:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1010886, 1012664    

Description wfink 2013-09-18 17:29:34 UTC
If a entity method is called via the component interface and inside this method actions are called which force a database synchronization, i.e. ejbSelect... or finder, a following change to this entity might not persist to the database if a ejbSelect or finder is called.

This will be temporary an inconsistent state.



Example:

EntityA {
  abstract void setAttrib1(int attrib);
  abstract void setAttrib2(int attrib);
  abstract void ejbSelect1(...);

  public void update(...) {
    setAttrib1(...);
    ejbSelect1(...);  // the attrib1 will be flushed to the DB
    setAttrib2(...);  // this attrib might not flushed until there is no other CMP entity method invoked
  }


As workaround the setter can be called via the LocalObject, i.e.
   ((EntityALocal)myEntityContext.getEJBLocalObject()).setAttrib2(...)

Comment 4 Jan Martiska 2013-10-07 08:17:49 UTC
Verified in EAP 6.2.0.ER4.