Bug 973945 - EJB2 CMP entity-command is not working
EJB2 CMP entity-command is not working
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: EJB (Show other bugs)
Unspecified Unspecified
high Severity unspecified
: ER3
: EAP 6.1.1
Assigned To: wfink
Depends On:
Blocks: 973947
  Show dependency treegraph
Reported: 2013-06-13 03:25 EDT by wfink
Modified: 2013-09-16 16:30 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 973947 (view as bug list)
Last Closed: 2013-09-16 16:30:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description wfink 2013-06-13 03:25:43 EDT
Description of problem:
To use different customizations and optimizations it was possible in former version to add entity-commands to the jbosscmp-jdbc.xml DD

      <entity-command name="no-select-before-insert" />
      <entity-command name="no-select-before-insert">

The current behaviour is that the configuration is checked (it is not possible to declare a non existing command name) but there is no effect if the entity is created at runtime.
The default command "SELECT COUNT(*)" is still executed.
Comment 1 wfink 2013-06-13 03:27:58 EDT
Looking into the JDBCCreateEntityCommand class it is extending the JDBCInsertPKCreateCommand which extends the JDBCAbstractCreateCommand.

Within JDBCInsertPKCreateCommand following lines made us looking into the details:
        if (exceptionProcessor == null) {
Esp. as we do not want the exists SQL it needs to be made sure that a exceptionProcessor is set. This handling is implemented in the JDBCAbstractCreateCommand class.

With in JDBCAbstractCreateCommand class:
        JDBCEntityCommandMetaData entityCommand = manager.getMetaData().getEntityCommand();
        if (entityCommand == null) {
            throw MESSAGES.entityCommandIsNull();
So, debugging in runtime shows that JDBCEntityCommandMetaData entityCommand is correctly intialized:
	[commandName=no-select-before-insert,commandClass=class org.jboss.as.cmp.jdbc.JDBCCreateEntityCommand,attributes={SQLExceptionProcessor=jboss.jdbc:service=SQLExceptionProcessor}]
So, then initEntityCommand(entityCommand) is called:
    protected void initEntityCommand(JDBCEntityCommandMetaData entityCommand) {
        exceptionProcessor = null;
Here we do not understand: the exceptionProcessor is set to null (even the command has all the details) causing theat the JDBCInsertPKCreateCommand does not find the exceptionProcessor and creates an existsSQL statement - which is always fired ... even we did not want if by setting <entity-command name="no-select-before-insert" />.
Comment 6 wfink 2013-07-03 08:49:17 EDT
As this is related to a customer issue is it possible to have the solution for EAP6.1.1?
Comment 7 Jan Martiska 2013-07-26 04:09:31 EDT
Verified the fix in EAP 6.1.1.ER3.
Comment 8 Scott Mumford 2013-08-28 22:55:15 EDT
Marking for exclusion from the 6.1.1 Release Notes document as an entry for this bug could not be completed or verified in time.

Note You need to log in before you can comment on or make changes to this bug.