ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jamison (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATIS-277) selectKey execution order attribute
Date Tue, 28 Mar 2006 13:09:23 GMT
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

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);



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

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