You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Sven.Boden" <li...@pandora.be> on 2006/03/01 07:57:31 UTC

Re: [jira] Commented: (IBATIS-224) isNotNull node causes typehandler mappings in statement to fail

Sure, but in JDK 1.4 there are also no enums. In the static part at the top of the class I run the method once and this determines whether we're in post or pre java 5 (the name of the variables will still probably change).

So on 1.3/1.4 the only speed difference is minimal as the calculation only happens once statically. On Java 5 and further it drops in the calculation to get at the "base type" of an enum. I used reflection just to bridge between having and not having getEnclosingClass.

Regards,
Sven

>----- Oorspronkelijk bericht -----
>Van: Nathan Maves (JIRA) [mailto:ibatis-dev@incubator.apache.org]
>Verzonden: woensdag, maart 1, 2006 04:48 AM
>Aan: dev@ibatis.apache.org
>Onderwerp: [jira] Commented: (IBATIS-224) isNotNull node causes typehandler mappings in statement to fail
>
>    [ http://issues.apache.org/jira/browse/IBATIS-224?page=comments#action_12368208 ] 
>
>Nathan Maves commented on IBATIS-224:
>-------------------------------------
>
>I am not sure that this fix will work for 1.4 jdk's.
>
>Acording to http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Class.html
>
>There is no method getEnclosingClass().
>
>So I would think that this fix with would throw a NoSuchMethod exception.
>
>Just my thoughts... 
>
>
>
>> isNotNull node causes typehandler mappings in statement to fail
>> ---------------------------------------------------------------
>>
>>          Key: IBATIS-224
>>          URL: http://issues.apache.org/jira/browse/IBATIS-224
>>      Project: iBatis for Java
>>         Type: Bug
>>   Components: SQL Maps
>>     Versions: 2.1.6
>>  Environment: linux/java 1.5
>>     Reporter: Reuben Firmin
>>     Priority: Critical
>>  Attachments: UnknownTypeHandler.java, ibatis-224_sven.zip, ibatis224.tar.gz
>>
>> Here's my insert statement.
>>     <insert id="createDeployment" parameterClass="deployment">
>>         INSERT INTO Deployment (
>>             environmentId, deploymentTypeId, deploymentStatusId, deploymentTime
>>                 <isNotNull property="threadCountOverride">,threadCountOverride</isNotNull>
>>         ) VALUES (
>>             #environmentId#, #deploymentTypeId#, #deploymentStatusId#, #deploymentTime#
>>                 <isNotNull property="threadCountOverride">,#threadCountOverride#</isNotNull>
>>         )
>>         <selectKey resultClass="int" keyProperty="deploymentId">
>>             SELECT @@IDENTITY as value
>>         </selectKey>
>>     </insert>
>> deploymentTypeId and deploymentStatusId are enums in the bean, mapped to values using custom type handlers. Without the isNotNull structure around threadCountOverride (which *is* nullable), the statement works. With the isNotNull, deploymentStatusId and deploymentTypeId are mapped to UnknownTypeHandler, and the insert fails to map the parameters from the bean.
>
>-- 
>This message is automatically generated by JIRA.
>-
>If you think it was sent incorrectly contact one of the administrators:
>   http://issues.apache.org/jira/secure/Administrators.jspa
>-
>For more information on JIRA, see:
>   http://www.atlassian.com/software/jira
>
>
>