Hi ironbird,

Here's the latest...

anonymous wrote : You think that the error is for your questions bean. I think the 
error is for your QuestionCategory bean. 
  | Try to activate cmp plugin traces to see the generated SQL in jboss log file. 

The reason I think this is that I am not instantiating a QuestionCategory bean 
anyplace and I am only instantiating a Question bean once in a test servlet.  When I 
go to that servlet (and after turning on log4j tracing) I get

2004-05-31 22:35:09,054 TRACE [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] 
Resized cache for bean QuestionCategory: old capacity = 1000000, new capacity = 50
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.system.Registry] lookup 
1524151178=jboss.j2ee:jndiName=ejb/tutorial/Fibo,service=EJB
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start 
method=create
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current 
transaction in MI is null
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED 
for create
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came 
in with tx null
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting 
new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pegasus//5, BranchQual=]
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] 
TxInterceptorCMT: In finally
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.LogInterceptor] End 
method=create
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.system.Registry] lookup 
102234528=jboss.j2ee:jndiName=ejb/tutorial/Question,service=EJB
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.LogInterceptor] Start 
method=findByPrimaryKey
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current 
transaction in MI is null
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TX_REQUIRED 
for findByPrimaryKey
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Thread came 
in with tx null
  | 2004-05-31 22:35:10,095 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Starting 
new tx TransactionImpl:XidImpl [FormatId=257, GlobalId=pegasus//7, BranchQual=]
  | 2004-05-31 22:35:10,105 TRACE [org.jboss.ejb.plugins.EntityInstancePool] Get 
instance [EMAIL PROTECTED] tutorial.ejb.QuestionBean
  | 2004-05-31 22:35:10,105 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] 
Executing SQL: SELECT id FROM question WHERE id=?
  | 2004-05-31 22:35:10,105 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] 
Set parameter: index=1, jdbcType=BIGINT, value=1
  | 2004-05-31 22:35:10,105 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] 
Find failed
  | java.sql.SQLException: ERROR:  Relation "question" does not exist

which is what I expected: a PreparedStatement with one parameter.

BTW, when I did a grep SELECT server.log I got the following:

      SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS
  |       SELECT_MAX_TX = SELECT MAX(TXID) FROM JMS_MESSAGES
  |       SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, ESSAGEBLOB FROM JMS_MESSAGES 
WHERE DESTINATION=?
  |       SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE 
MESSAGEID=? AND DESTINATION=?
  |       DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXID IN 
(SELECT TXID FROM  JMS_TRANSACTIONS) AND TXOP=? 2004-05-31 22:22:21,180 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.QuestionCategory] Entity 
Exists SQL: SELECT COUNT(*) FROM questioncategory WHERE id=?
  | 2004-05-31 22:22:21,320 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.QuestionCategory#findByPrimaryKey]
 SQL: SELECT id FROM questioncategory WHERE id=?
  | 2004-05-31 22:22:21,340 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Question] Entity Exists SQL: 
SELECT COUNT(*) FROM question WHERE id=?
  | 2004-05-31 22:22:21,380 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] 
SQL: SELECT id FROM question WHERE id=?
  | 2004-05-31 22:22:55,379 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.Question#findByPrimaryKey] 
Executing SQL: SELECT id FROM question WHERE id=?

So maybe some of these other sql statements are causing the problem.

anonymous wrote : No, the EJB spec from SUN says that the where clause in EJB-QL must 
refers to the abstract schema name of your bean, which is QuestionCategory, not 
QuestionCategoryBean. So your EJB-QL should be 
  | Code: 
  | 
  | SELECT OBJECT(qcb) FROM QuestionCategory qcb WHERE qcb.id = ?1

Well, then there may be two bugs with JBoss 3.2.3:

Bug #1 Non Recognition Of <abstract-schema-name>

When I tested without my re-definition of findByPrimaryKey(), 
I changed Question descriptor in ejb-jar.xml to
      <entity >
  |          <description><![CDATA[EJB that manages a Question]]></description>
  |          <display-name>Question EJB</display-name>
  | 
  |          <ejb-name>Question</ejb-name>
  | 
  |          <home>tutorial.interfaces.QuestionHome</home>
  |          <remote>tutorial.interfaces.Question</remote>
  | 
  |          <ejb-class>tutorial.ejb.QuestionBean</ejb-class>
  |          <persistence-type>Container</persistence-type>
  |          <prim-key-class>java.lang.Long</prim-key-class>
  |          <reentrant>False</reentrant>
  |          <cmp-version>2.x</cmp-version>
  |          <abstract-schema-name>Questions</abstract-schema-name>
  |          <cmp-field >
  |             <description><![CDATA[]]></description>
  |             <field-name>id</field-name>
  |          </cmp-field>
  |          <cmp-field >
  |             <description><![CDATA[]]></description>
  |             <field-name>question</field-name>
  |          </cmp-field>
  |          <cmp-field >
  |             <description><![CDATA[]]></description>
  |             <field-name>categoryId</field-name>
  |          </cmp-field>
  |          <cmp-field >
  |             <description><![CDATA[]]></description>
  |             <field-name>level</field-name>
  |          </cmp-field>
  |          <primkey-field>id</primkey-field>
  | 
  |          <resource-ref >
  |             <res-ref-name>jdbc/PostgresDS</res-ref-name>
  |             <res-type>javax.sql.DataSource</res-type>
  |             <res-auth>Container</res-auth>
  |          </resource-ref>
  | 
  |       <!-- Write a file named ejb-finders-QuestionBean.xml if you want to define 
extra finders. -->
  |       </entity>
  | 
  |   

and it didn't key of the abstract schema name.

Bug #2 No Overiding Of findByPrimaryKey()

When I left in my definition of findByPrimaryKey() (and with the changed schema name) 
I set the query to

SELECT OBJECT(qb) FROM Questions qb WHERE qb.id = ?1

and it did not take my version; I would have expected my version to trump the default 
version by the container.


I appreciate your comments and I encourage and welcome any other thoughts while I try 
more tests and debugging.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3837021#3837021

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3837021



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to