This is like pulling teeth. Just tell me what you want and why, short
and sweet. Think 72 words.
I should true map to 1 and false to 0 in Oracle, SQLServer and MySQL? I
add some more metadata for this.
-dain
Stephen Coy wrote:
> Oracle does not grok "true" or "false" . It does not have a boolean data
> type.
>
> According to my "SQL in a Nutshell", neither does Microsoft SQL Server
> or MySQL. Postgres on the other hand does.
>
> Consequently standardjbosscmp-jdbc.xml maps booleans in Oracle:
>
> <mapping>
> <java-type>java.lang.Boolean</java-type>
> <jdbc-type>BIT</jdbc-type>
> <sql-type>NUMBER(1)</sql-type>
> </mapping>
>
>
>
> On Tuesday, May 14, 2002, at 01:50 PM, Dain Sundstrom wrote:
>
>> I don't get this. The log says it is executing this query:
>>
>> SELECT DISTINCT
>> t0_bean.a_Boolean, t0_bean.an_Int, t0_bean.a_Long,
>> t0_bean.a_Double, t0_bean.a_String
>> FROM CMP2ENTITY t0_bean
>> WHERE t0_bean.a_Boolean = true
>>
>> So what is wrong with that where clause? Are there any Oracle DBAs
>> out there that can shed some light on to why this query is rejected.
>>
>> -dain
>>
>> Stephen Coy wrote:
>>
>>> Reposted here at Dain's request...
>>> Begin forwarded message:
>>> Hi All,
>>> I think I have found a bug when specifying your own finder method
>>> with EJB QL and Oracle.
>>> The problem is that in EJB QL any comparisons to a boolean field
>>> must be made using the keywords TRUE or FALSE. When I do this I get
>>> an exception come back fromOracle telling me it doesn't know the
>>> field name. It seems that JBoss is not converting the TRUE or FALSE
>>> to a 1 or 0 when it sends the SQL to Oracle, that is,
>>> "...wheremyBoolean = true" is being sent to Oracle.
>>> I have tried all possible sensible <jdbc-type> to <sql-type> tags in
>>> the XML files.
>>> Anyway,I have created a unit test package for this - it is
>>> attached. It plugs into the JBoss testsuite. To compile the test,
>>> you will need to add the following to the jboss-all/testsuite/build.xml:
>>> <target name="jars" description="Builds all jar files."
>>> depends="compile,
>>> ...
>>> _jars-dbtest,
>>> _jars-findWhereBoolean,
>>> ...
>>> _jars-bankiiop">
>>> </target>
>>> <!-- findWhereBoolean test -->
>>> <target name="_jars-findWhereBoolean">
>>> <mkdir dir="${build.lib}"/>
>>> <!-- build findWhereBooleanTestClient.jar -->
>>> <jar jarfile="${build.lib}/findWhereBooleanTestClient.jar"
>>> manifest="${build.etc}/manifest.mf">
>>> <fileset dir="${build.classes}">
>>> <patternset refid="common.test.client.classes"/>
>>> <include name="org/jboss/test/findWhereBoolean/interfaces/**"/>
>>> <include name="org/jboss/test/findWhereBoolean/test/**"/>
>>> </fileset>
>>> <fileset dir="${build.resources}/findWhereBoolean">
>>> <include name="*.*"/>
>>> </fileset>
>>> </jar>
>>> <!-- build findWhereBoolean.jar -->
>>> <jar jarfile="${build.lib}/findWhereBoolean.jar">
>>> <fileset dir="${build.classes}">
>>> <patternset refid="common.test.application.classes"/>
>>> <include name="org/jboss/test/findWhereBoolean/interfaces/**"/>
>>> <include name="org/jboss/test/findWhereBoolean/bean/**"/>
>>> </fileset>
>>> <fileset dir="${build.resources}/findWhereBoolean">
>>> <include name="**/*.xml"/>
>>> </fileset>
>>> </jar>
>>> </target>
>>> If you're interested, the actual JBoss server.log error message and
>>> stack trace is:
>>> 2002-05-13 18:18:45,506 DEBUG
>>>
>[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.CMP2Entity.findAllWhereBooleanIsTrue]
>>>
>>> Executing SQL: SELECT DISTINCT t0_bean.a_Boolean, t0_bean.an_Int,
>>> t0_bean.a_Long, t0_bean.a_Double, t0_bean.a_String FROM CMP2ENTITY
>>> t0_bean WHERE t0_bean.a_Boolean = true
>>> 2002-05-13 18:18:45,516 DEBUG
>>>
>[org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.CMP2Entity.findAllWhereBooleanIsTrue]
>>>
>>> Find failed
>>> java.sql.SQLException: ORA-00904: invalid column name
>>> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
>>> at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
>>> at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
>>> at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)
>>> at
>>> oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:651)
>>>
>>> at
>>> oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2117)
>>>
>>> at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
>>> (OracleStatement.java:2331) at
>>> oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
>>> (OraclePreparedStatement.java:422) at
>>> oracle.jdbc.driver.OraclePreparedStatement.executeQuery
>>> (OraclePreparedStatement.java:366) at
>>> org.jboss.resource.adapter.jdbc.local.PreparedStatementInPool.executeQuery(
>>>
>>> PreparedStatementInPool.java:862) at
>>> org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute
>>> (JDBCAbstractQueryCommand.java:107) at
>>> org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntitiesCommand.execute
>>> (JDBCFindEntitiesCommand.java:40) at
>>> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntities
>>> (JDBCStoreManager.java:466) at
>>> org.jboss.ejb.plugins.CMPPersistenceManager.findEntities
>>> (CMPPersistenceManager.java:348) at
>>> org.jboss.resource.connectionmanager.CachedConnectionInterceptor.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:1111) at
>>> org.jboss.ejb.plugins.AbstractInterceptor.invokeHome
>>> (AbstractInterceptor.java:73) at
>>> org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome
>>> (EntitySynchronizationInterceptor.java:230) at
>>> org.jboss.resource.connectionmanager.CachedConnectionInterceptor.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:727)
>>> 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:241)
>>> at sun.rmi.transport.Transport$1.run(Transport.java:152)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
>>> at
>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
>>> at
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:
>>>
>>> 706) at java.lang.Thread.run(Thread.java:484)
>>> I would appreciate any fix or workaround.
>>> Thanks,
>>> Evan.
>>> Evan Toliopoulos
>>> Whitesmiths Australia Pty Ltd
>>> Level 6, 44 Miller Street
>>> North Sydney, 2060, Australia
>>> Tel: + 61 2 8912 1728
>>> Fax: + 61 2 8912 1701
>>> Web: http://www.whitesmiths.com.au
>>>
>>
>>
>> -- xxxxxxxxxxxxxxxxxxxxxxxxx
>> Dain Sundstrom
>> Chief Architect, JBossCMP
>> JBoss Group, LLC
>> xxxxxxxxxxxxxxxxxxxxxxxxx
>>
>
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
--
xxxxxxxxxxxxxxxxxxxxxxxxx
Dain Sundstrom
Chief Architect, JBossCMP
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxxx
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user