Queries not sent to DB engine??
gvil Oct 19, 2005 10:01 AMHi all,
I'm trying to create my very first CMP and I have a "strange" problem: it seems to me that the SQL queries are not sent to mysql server. Briefly:
1) I coded a CMP bean named "Folder" with a couple of attributes and a find method findAll using the simple query SELECT OBJECT(o) FROM folder o; I also coded a session bean which calls the findAll() method on Folder and prints the collection on stdout
2) I created a suitable db named catalogue and a table named folder, with fields exactly matching the CMP's ones; ejb-jar.xml maps the CMP to table/fields
3) I created and published the datasource; it works, because I was able to build a client application which perfomrs a lookup, get a new connection and execute a select *; when I run this test, mysql log correctly displays my query.
4) when run the session bean code and call findAll, the system returns me an empty collection; the jboss' logs say that the EJB QL statement ran with no errors; on the other hand mysql's logs reports that the connection was established but no query was submitted. I run the test also immediatly after a jboss restart.
jboss version is 4.0.2
mysql version is 4.1.14
java is 1.5.0_03
os is linux 2.6
I enabled full logging for both jboss and mysql server. Here are the most (I hope) significant lines:
jboss' server.log
2005-10-19 15:20:35,492 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Folder#findAll] Executing SQL: SELECT t0_o.id FROM Folder t0_o
2005-10-19 15:20:35,492 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] supplying ManagedConnection from pool: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@dc64a2[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@152f43b handles=0 lastUse=1129728025610 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@1205d8d context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1de152f]
2005-10-19 15:20:35,492 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Getting connection from pool org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@dc64a2[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@152f43b handles=0 lastUse=1129728025610 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@1205d8d context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1de152f] [InUse/Available/Max]: [1/19/20]
2005-10-19 15:20:35,503 TRACE [org.jboss.ejb.plugins.EntityInstancePool] 0/100 Free instance:org.jboss.ejb.plugins.EntityInstancePool@f6af3b#null#null#false#class it.gv.FolderBean
2005-10-19 15:20:35,503 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] TxInterceptorCMT: In finally
2005-10-19 15:20:35,503 TRACE [org.jboss.ejb.plugins.LogInterceptor] End method=findAll
2005-10-19 15:20:35,503 INFO [STDOUT] Collection []
mysql's log
051019 15:20:35 11 Connect catalogue@localhost on catalogue
11 Query SET NAMES latin1
11 Query SET character_set_results = NULL
11 Query SHOW VARIABLES
11 Query SHOW COLLATION
11 Query SET autocommit=1
11 Query SHOW VARIABLES LIKE 'tx_isolation'
11 Query SET autocommit=0
11 Query commit
I'll appreciate any help; of course I will post additional info if required.
Thanks,
gv