ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Goodin (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-147) Using Java constants in statements
Date Tue, 07 Jun 2005 13:20:57 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-147?page=comments#action_12312881 ] 

Brandon Goodin commented on IBATIS-147:

Daniel Silva's Comments from the user list
I may be saying something really stupid but, well, progress comes
along with a lot of stupid questions :)

Let's suppose you have a class or interface loaded with plenty of
constants. If i create a type alias for that, can i use it in my sql
maps using the dot notation?

For instance:

public class MyConstants {

   public static String CONSTANT_1 = "blah";
   public static String CONSTANT_2 = "blah2";


In my sql maps i'd have a type alias for that class:

<typeAlias name="constants" type="MyConstants"/>

And in any sql map something like that:

<select ....>
 select * from foo where blah = #constants.CONSTANT_1#

Is that possible?

If not, how hard would be to implement it by creating an import
attribute for maps, for example?

So we would have:

<select  parameterMap="x" import="MyConstants">
  ... use MyConstants properties in here

And, inspired by all the sci-fi i had watched, maybe this import
attribute would allow me to even call static methods on those classes.

Opinions? Am I on crack?

> Using Java constants in statements
> ----------------------------------
>          Key: IBATIS-147
>          URL: http://issues.apache.org/jira/browse/IBATIS-147
>      Project: iBatis for Java
>         Type: New Feature
>   Components: SQL Maps
>     Reporter: Niall O'Neill
>     Priority: Minor

> It would be useful to be able to reference Java constants within an Sqlmap statement.
This would extend the benefits of constants (unchanging references, meaningful names) to SQL,
making maintenance easier.
> It could be facilitated using the existing parameterisation framework - for example:
#org.package.class.Constants.CONSTANT#. The field would be evaluated and substitution made,
or an parsing error thrown if the field is not static or otherwise accessible.

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