0 Replies Latest reply on Apr 17, 2003 7:49 PM by Cashcan

    JBOSS uppercases tablenames in EJB-QL generated select state

    Cashcan Newbie

      Does anyone have an idea of what I might be doing wrong or a way to track this problem down?

      My entity bean query fells for findByPrimaryKey and findByMenuId or any local or remote find method for that matter because the table name is Menu but the query is transposing Menu to all uppercase MENU when the query is executed and the table cannot be found. I have tried tirelessly to find the setting that is causing this to happen.

      I am running JBOSS version jboss-3.2.0_tomcat-4.1.24 with Sybase database and i have set up the proper configuration files. I've set up this arrangement before but it's a little different for this latest version but I don't think this is the problem yet.

      I have an entity bean called Menu for a Menu table with about 5 attributes in Sybase. I have built an ejb-jar.xml, jboss.xml, and jbosscmp-jdbc.xml file and jar'ed them then put it in an ear. It deploys perfect and Sybase appears to be set up properly. I've used JBOSS and Sybase many times before but not with this version.

      By the way, I took the select statement and tested it using a RapidSQL tool. It works when I correct the spelling to "dbo.Menu".

      Thanks.

      Here is an excerpt from the stack trace:
      run:
      [java] Got context
      [java] Got reference
      [java] javax.ejb.FinderException: Find failed: java.sql.SQLException: Table not found
      : DBO.MENU in statement [SELECT t0_o.menuID FROM DBO.MENU t0_o WHERE t0_o.menuID = 9800]
      [java] at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbs
      tractQueryCommand.java:194)
      [java] at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbs
      tractQueryCommand.java:91)
      [java] at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntitiesCommand.execute(JDBCFind
      EntitiesCommand.java:40)
      [java] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntities(JDBCStoreM
      anager.java:599)
      [java] at org.jboss.ejb.plugins.CMPPersistenceManager.findEntities(CMPPersistence
      Manager.java:324)
      [java] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEn
      tities(CachedConnectionInterceptor.java:323)
      [java] at org.jboss.ejb.EntityContainer.find(EntityContainer.java:660)
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
      va:39)
      [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
      ____________________________________________________________________________________

      Barring the ejb-jar scaffolding this is the entry for the Menu table.

      <![CDATA[]]>

      <ejb-name>Menu</ejb-name>

      com.neilsenmedia.nam.interfaces.MenuHome
      com.neilsenmedia.nam.interfaces.Menu
      <local-home>com.neilsenmedia.nam.interfaces.MenuLocalHome</local-home>
      com.neilsenmedia.nam.interfaces.MenuLocal

      <ejb-class>com.neilsenmedia.nam.ejb.MenuCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.neilsenmedia.nam.interfaces.MenuPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Menu</abstract-schema-name>
      <cmp-field >
      <![CDATA[Returns the menuId]]>
      <field-name>menuId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Returns the menuName]]>
      <field-name>menuName</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Returns the menuIcon]]>
      <field-name>menuIcon</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Returns the menuHelpText]]>
      <field-name>menuHelpText</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Returns the sortOrder]]>
      <field-name>sortOrder</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Returns the parentMenuId]]>
      <field-name>parentMenuId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Returns the applicationId]]>
      <field-name>applicationId</field-name>
      </cmp-field>
      <cmp-field >
      <![CDATA[Returns the contentId]]>
      <field-name>contentId</field-name>
      </cmp-field>


      <query-method>
      <method-name>findAll</method-name>
      <method-params>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql><![CDATA[SELECT OBJECT(o) FROM Menu o]]></ejb-ql>


      <![CDATA[menuID is indexed.]]>
      <query-method>
      <method-name>findByMenuId</method-name>
      <method-params>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Remote</result-type-mapping>
      <ejb-ql><![CDATA[select object(o) from Menu o where o.menuId = ?1]]></ejb-ql>


      <![CDATA[menuName is not indexed.]]>
      <query-method>
      <method-name>findByMenuName</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM Menu o WHERE o.menuName = ?1]]></ejb-ql>


      <![CDATA[menuIcon is not indexed.]]>
      <query-method>
      <method-name>findByMenuIcon</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM Menu o WHERE o.menuIcon = ?1]]></ejb-ql>


      <![CDATA[menuHelpText is not indexed.]]>
      <query-method>
      <method-name>findByMenuHelpText</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM Menu o WHERE o.menuHelpText = ?1]]></ejb-ql>


      <![CDATA[sortOrder is not indexed.]]>
      <query-method>
      <method-name>findBySortOrder</method-name>
      <method-params>
      <method-param>short</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM Menu o WHERE o.sortOrder = ?1]]></ejb-ql>


      <![CDATA[parentMenuID is not indexed.]]>
      <query-method>
      <method-name>findByParentMenuId</method-name>
      <method-params>
      <method-param>int</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(o) FROM Menu o WHERE o.parentMenuId = ?1]]></ejb-ql>




      This is the entry for the jboss barring the scaffolding :

      <ejb-name>Menu</ejb-name>
      <jndi-name>Menu</jndi-name>
      <local-jndi-name>com.abc.nam.MenuLocalHome</local-jndi-name>



      This is the entry for the jbosscom-jdbc barring the scaffolding:

      <ejb-name>Menu</ejb-name>
      <create-table>false</create-table>
      <table-name>dbo.Menu</table-name>

      <cmp-field>
      <field-name>menuId</field-name>
      <column-name>menuID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>menuName</field-name>
      <column-name>menuName</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>menuIcon</field-name>
      <column-name>menuIcon</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>menuHelpText</field-name>
      <column-name>menuHelpText</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>sortOrder</field-name>
      <column-name>sortOrder</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>parentMenuId</field-name>
      <column-name>parentMenuID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>applicationId</field-name>
      <column-name>applicationID</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>contentId</field-name>
      <column-name>contentID</column-name>

      </cmp-field>