ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Closed: (IBATIS-277) selectKey execution order attribute
Date Thu, 08 Jun 2006 16:43:32 GMT
     [ http://issues.apache.org/jira/browse/IBATIS-277?page=all ]
Jeff Butler closed IBATIS-277:

    Fix Version: 2.2.0
     Resolution: Fixed

Fixed (and documented) in SVN.

> selectKey execution order attribute
> -----------------------------------
>          Key: IBATIS-277
>          URL: http://issues.apache.org/jira/browse/IBATIS-277
>      Project: iBatis for Java
>         Type: Improvement

>   Components: SQL Maps
>     Versions: 2.1.7
>  Environment: Any
>     Reporter: Jamison
>     Assignee: Jeff Butler
>      Fix For: 2.2.0

> I did some poking around and found that iBatis for .NET has a 'type' attribute for the
selectKey element that controls when the selectKey is executed. It would be beneficial to
me if this attribute was introduced (possible values pre or post) because it would reduce
changing the order of execution changing a property in an included property file instead of
a rather painful process that requires a lot of manual intervention.
> The following code would do it I think, but I have not actually tested it since I don't
have an iBatis dev env set up.. please forgive my laziness. 
> Line 301 of com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser:
> if (selectKeyStatement != null) {
>   Properties attributes = NodeletUtils.parseAttributes(node, vars.properties);
>   String keyType = attributes.getProperty("type", foundTextFirst ? "post" : "pre");
>   //  I think I should throw an exception if it is not pre or post...
>   if (!(keyType.equlas("pre") || keyType.equlas("post"))){
>     throw new SqlMapException("Error.  selectKey type attribute value invalid: " + keyType);
>   }
>   selectKeyStatement.setAfter(keyPropName.equals("post"));
> }
> Of course the DTD would need to be changed too:
> <!ELEMENT selectKey (#PCDATA | include)*>
> <!ATTLIST selectKey
> resultClass CDATA #IMPLIED
> keyProperty CDATA #IMPLIED
> >
> It is a truly minute code change and it would save my team an incredible amount of very
error-prone work.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message