Bugs item #567441, was opened at 2002-06-11 10:27 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=567441&group_id=22866
Category: JBossCMP Group: v3.0 Rabbit Hole Status: Open Resolution: None Priority: 5 Submitted By: Andras Soltesz (soltesz_andras) >Assigned to: Dain Sundstrom (dsundstrom) Summary: EJB QL finder fails to map boolean,MySQL Initial Comment: Operating system: Windows Me JDK version: 1.3.1_03 Server trace: ------------------------------------------------------------------ 2002-06-11 17:03:05,330 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Map.findBig Maps] Executing SQL: SELECT t0_m.id FROM MapTable t0_m WHERE t0_m.bigMap = true 2002-06-11 17:03:05,660 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Map.findBig Maps] Find failed java.sql.SQLException: Column not found: Unknown column 'true' in 'where clause' at org.gjt.mm.mysql.MysqlIO.sendCommand (MysqlIO.java:497) at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect (MysqlIO.java:550) at org.gjt.mm.mysql.Connection.execSQL (Connection.java:885) at org.gjt.mm.mysql.PreparedStatement.executeQuery (PreparedStatement.java:288) at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement. executeQuery(LocalPreparedStatement.java:289) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.ex ecute(JDBCAbstractQueryCommand.java:107) at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntitiesCommand.exec ute(JDBCFindEntitiesCommand.java:40) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntities (JDBCStoreManager.java:473) at org.jboss.ejb.plugins.CMPPersistenceManager.findEntities (CMPPersistenceManager.java:348) at org.jboss.resource.connectionmanager.CachedConnectionInterc eptor.findEntities(CachedConnectionInterceptor.java:284) at org.jboss.ejb.EntityContainer.find (EntityContainer.java:662) at java.lang.reflect.Method.invoke(Native Method) at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome (EntityContainer.java:1116) at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome (AbstractInterceptor.java:73) at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHo me(EntitySynchronizationInterceptor.java:257) at org.jboss.resource.connectionmanager.CachedConnectionInterc eptor.invokeHome(CachedConnectionInterceptor.java:176) at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome (EntityInstanceInterceptor.java:134) at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome (EntityLockInterceptor.java:79) at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome (EntityCreationInterceptor.java:44) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext (AbstractTxInterceptor.java:98) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions (TxInterceptorCMT.java:167) at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome (TxInterceptorCMT.java:52) at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome (SecurityInterceptor.java:104) at org.jboss.ejb.plugins.LogInterceptor.invokeHome (LogInterceptor.java:109) at org.jboss.ejb.EntityContainer.invokeHome (EntityContainer.java:487) at org.jboss.ejb.Container.invoke(Container.java:726) at org.jboss.ejb.EntityContainer.invoke (EntityContainer.java:1055) at org.jboss.mx.server.MBeanServerImpl.invoke (MBeanServerImpl.java:491) at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke (JRMPInvoker.java:364) at java.lang.reflect.Method.invoke(Native Method) at sun.rmi.server.UnicastServerRef.dispatch (UnicastServerRef.java:236) at sun.rmi.transport.Transport$1.run (Transport.java:147) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall (Transport.java:143) at sun.rmi.transport.tcp.TCPTransport.handleMessages (TCPTransport.java:460) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run (TCPTransport.java:701) at java.lang.Thread.run(Thread.java:479) ----------------------------------------------------------------------------------- Reproduction of the bug: I have a simple entity bean (Map) with a boolean property called bigMap. The entity is stored in a MySQL table called MapTable. I have a finder method defined for the entity in the ejb-jar.xml. The definition of the query: <query> <query-method> <method-name>findBigMaps</method-name> <method-params/> </query-method> <ejb-ql> SELECT OBJECT(m) FROM MapBean AS m WHERE m.bigMap=true </ejb-ql> </query> -The deployment goes all right (including the automatic table creation in the MySQL database). -Object creation through the home interface is OK, the boolean property is mapped to a TINYINT database field (0-true, 1-false). I checked it on the MySQL console, the values are correctly translated during the creation of a new object. -When I want to find the objects which have the bigMap property set to true (with the findBigMap finder method declared in the ejb- jar.xml) I get the exception aforementioned. When I use the Hypersonic database with table autocreate, the finder works perfectly. This can mean that the EJB QL boolean value mapping (1=true) doesn't work only with the MySQL database. In case of the Hypersonic there might not need to translate booleans, that might be why the feature developers didn't notice the bug earlier. This finder worked perfectly when I used this bean as an 1.1 entity bean and I had this finder defined in the jaws.xml. When I rewrote the bean as an EJB 2.0 compliant bean I had to use the jbosscmp-jdbc.xml instead of the jaws.xml and define the finder in the ejb-jar.xml as a standard EJB QL finder method. ---------------------------------------------------------------------- >Comment By: Dain Sundstrom (dsundstrom) Date: 2002-06-11 10:44 Message: Logged In: YES user_id=251431 This has already been fixed in HEAD and Branch-3_0. New true-mapping and false-mapping elements have been added to type-mapping. The mapping for mySQL is 1 and 0 respectively. Are you sure that TRUE=0 and FALSE=1 in mySQL? ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=567441&group_id=22866 _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development