ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Benedict (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATIS-215) BSF for dynamic queries
Date Thu, 03 Nov 2005 00:42:55 GMT
BSF for dynamic queries

         Key: IBATIS-215
         URL: http://issues.apache.org/jira/browse/IBATIS-215
     Project: iBatis for Java
        Type: New Feature
  Components: SQL Maps  
    Reporter: Paul Benedict

While the list of tags to form dynamic queries is suitable, they are limiting because they
stop the "dreamer from dreaming." More complex logic cannot be addressed without creating
a barrage of new tags.

I propose a new tag called <script> (or something similar) which is backed by the Apache
Bean Scripting Framework. The parameter map passed in to the <statement> should load
it into the scripting Interpreter object and expose it for the <script> tag so that
dynamic Java or JavaScript can return boolean parameters. Obviously there is a performance
hit for this and the previous tags would be much simpler for common boolean operations, but
the sky is the limit when it comes to what you can compare inside the script.

<select id="dynamicGetAccountList" cacheModel="resultMap="account-result" >
    select * from ACCOUNT
   <script><expression>obj.id != null && obj.id > 0 && obj.lastName.startsWith("B")"</expression>
     where ACC_ID = #id# and
    ACC_NAME = #lastName#
  order by ACC_LAST_NAME

If BSF is not suitable, please look into OGNL which is popular within Apache Tapestry and
is a very good alternative.

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