[jboss-jira] [JBoss JIRA] (AS7-6079) EJB 2.1 CMP configuration options missing (sync-on-commit-only, insert-after-ejb-post-create, call-ejb-store-on-clean)

Tiago Frazão (JIRA) jira-events at lists.jboss.org
Tue Jan 29 07:19:47 EST 2013


    [ https://issues.jboss.org/browse/AS7-6079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12750999#comment-12750999 ] 

Tiago Frazão commented on AS7-6079:
------------------------------------

Hi Guys,

I do still have the issue ... and i had to change a little bit the Jboss code to overcome the problem.

When we define the configurations (sync-on-commin-only, insert-after-ejb-post-create, call-ejb-store-on-clean) in "jbosscmp-jdbc.xml" like bellow :

<jbosscmp-jdbc>
   <defaults>
      <datasource>java:jboss/datasources/XptoDS</datasource>
      <datasource-mapping>Oracle9i</datasource-mapping>
      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <sync-on-commit-only>true</sync-on-commit-only>
      <insert-after-ejb-post-create>true</insert-after-ejb-post-create>
      <call-ejb-store-on-clean>true</call-ejb-store-on-clean>
   </defaults>
   <entity>
     <ejb-name>User</ejb-name>
     <table-name>USER</table-name>
     <cmp-field><field-name>name</field-name>
     <column-name>NAME</column-name></cmp-field>
    </entity>
...
</jbosscmp-jdbc>

During the lifecycle of org.jboss.as.cmp.processors.CmpParsingProcessor, the default values previously settled (in <defaults>) are been replaced for the one defined in <entity> scope, but if we do not define anything like above, the CmpParsinProcessor is using the default values of the CmpConfig. (primitive values)

I had to change 2 classes to skip this problem and I would like to know if is applicable or make sense for you.

public class CmpConfig {
	private boolean syncOnCommitOnly;
	private boolean insertAfterEjbPostCreate;
	private boolean callEjbStoreOnClean = true;

	private boolean wasSyncOnCommitOnlyChanged = false;
	private boolean wasInsertAfterEjbPostCreateChanged = false;
	private boolean wasCallEjbStoreOnCleanChanged = false;

	public boolean isSyncOnCommitOnly() {
		return syncOnCommitOnly;
	}

	public void setSyncOnCommitOnly(boolean syncOnCommitOnly) {
		this.syncOnCommitOnly = syncOnCommitOnly;
		this.wasSyncOnCommitOnlyChanged = true;
	}

	public boolean isInsertAfterEjbPostCreate() {
		return insertAfterEjbPostCreate;
	}

	public void setInsertAfterEjbPostCreate(boolean insertAfterEjbPostCreate) {
		this.insertAfterEjbPostCreate = insertAfterEjbPostCreate;
		this.wasInsertAfterEjbPostCreateChanged = true;
	}

	public boolean isCallEjbStoreOnClean() {
		return callEjbStoreOnClean;
	}

	public void setCallEjbStoreOnClean(boolean callEjbStoreOnClean) {
		this.callEjbStoreOnClean = callEjbStoreOnClean;
		this.wasCallEjbStoreOnCleanChanged = true;
	}

	public boolean wasSyncOnCommitOnlyChanged() {
		return wasSyncOnCommitOnlyChanged;
	}

	public boolean wasInsertAfterEjbPostCreateChanged() {
		return wasInsertAfterEjbPostCreateChanged;
	}

	public boolean wasCallEjbStoreOnCleanChanged() {
		return wasCallEjbStoreOnCleanChanged;
	}
}

and

public JDBCEntityMetaData(JDBCApplicationMetaData jdbcApplication, ParsedEntity parsed, JDBCEntityMetaData defaultValues) {
       ....
       ....
       localHomeClass = defaultValues.getLocalHomeClass();
       localClass = defaultValues.getLocalClass();
       cmpConfig = defaultValues.getCmpConfig(); // --> added
       ....
       .... 
       // cmpConfig = parsed.getCmpConfig(); -- removed

       // -- added
        if (parsed.getCmpConfig().wasSyncOnCommitOnlyChanged()) {
        	cmpConfig.setSyncOnCommitOnly(parsed.getCmpConfig().isSyncOnCommitOnly());
        } 

       // -- added
        if (parsed.getCmpConfig().wasInsertAfterEjbPostCreateChanged()) {
        	cmpConfig.setInsertAfterEjbPostCreate(parsed.getCmpConfig().isInsertAfterEjbPostCreate());
        } 

        // -- added
        if (parsed.getCmpConfig().wasCallEjbStoreOnCleanChanged()) {
        	cmpConfig.setCallEjbStoreOnClean(parsed.getCmpConfig().isCallEjbStoreOnClean());
        } 
}


Regards

                
> EJB 2.1 CMP configuration options missing (sync-on-commit-only, insert-after-ejb-post-create, call-ejb-store-on-clean)
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: AS7-6079
>                 URL: https://issues.jboss.org/browse/AS7-6079
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: EJB
>    Affects Versions: 7.1.0.Alpha1, 7.1.3.Final (EAP)
>            Reporter: Brad Maxwell
>            Assignee: Brad Maxwell
>             Fix For: 7.2.0.CR1, 7.1.4.Final (EAP)
>
>
> In JBoss AS 7, EJB 2.1 CMP beans cannot configure some options such as sync-on-commit-only and insert-after-ejb-post which were configurable in previous versions of JBoss.
> Should also confirm how to configure the rest of the options that were available previously.
> <container-configuration>
>          <container-name>Clustered CMP 2.x EntityBean</container-name>
>          <call-logging>false</call-logging>
>          <invoker-proxy-binding-name>clustered-entity-rmi-invoker</invoker-proxy-binding-name>
>          <sync-on-commit-only>false</sync-on-commit-only>
>          <insert-after-ejb-post-create>false</insert-after-ejb-post-create>
>          <container-interceptors>
>          ...
>          </container-interceptors>
>          <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
>          <instance-cache>org.jboss.ejb.plugins.EntityInstanceCache</instance-cache>
>          <persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>
>          <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
>          <container-cache-conf>
>             <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
>             <cache-policy-conf>
>                <min-capacity>50</min-capacity>
>                <max-capacity>1000000</max-capacity>
>                <overager-period>300</overager-period>
>                <max-bean-age>600</max-bean-age>
>                <resizer-period>400</resizer-period>
>                <max-cache-miss-period>60</max-cache-miss-period>
>                <min-cache-miss-period>1</min-cache-miss-period>
>                <cache-load-factor>0.75</cache-load-factor>
>             </cache-policy-conf>
>          </container-cache-conf>
>          <container-pool-conf>
>             <MaximumSize>100</MaximumSize>
>          </container-pool-conf>
>          <commit-option>B</commit-option>
>       </container-configuration>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the jboss-jira mailing list