Bug 973945 - EJB2 CMP entity-command is not working
Summary: EJB2 CMP entity-command is not working
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: EJB   
(Show other bugs)
Version: 6.1.0
Hardware: Unspecified Unspecified
Target Milestone: ER3
: EAP 6.1.1
Assignee: wfink
QA Contact:
Depends On:
Blocks: 973947
TreeView+ depends on / blocked
Reported: 2013-06-13 07:25 UTC by wfink
Modified: 2018-12-02 17:21 UTC (History)
4 users (show)

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

Attachments (Terms of Use)

Description wfink 2013-06-13 07:25:43 UTC
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 07:27:58 UTC
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 12:49:17 UTC
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 08:09:31 UTC
Verified the fix in EAP 6.1.1.ER3.

Comment 8 Scott Mumford 2013-08-29 02:55:15 UTC
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.