[ 
http://issues.apache.org/jira/browse/IBATIS-147?page=comments#action_12312882 ] 

Brandon Goodin commented on IBATIS-147:
---------------------------------------

currently everything is setter/getter based. So, you would need to
provide a getter at minimum for your constant. We could discuss direct
access to public properties. I don't think that would be too
difficult. It might even be a cool idea to use an alias like daniel
discussed. However, it would require some discussion on how to resolve
potential name conflicts. If you define 'myObject' as an alias to a
constant class and then in your mapped statement you had a 'myObject'
property on the parameterClass... how would you distinguish between
the myObject alias and the myObject property?

Ex.

<typeAlias name="myObject" type="my.super.cool.MyObject"/>

<select id="myCoolSelect" parameterClass="SomeClass">
SELECT ...
WHERE id=#myObject.aProperty# <-- how would we resolve this?
</select>

We might have to introduce a notation to define when an alias is being used.
Something like [EMAIL PROTECTED] for accessing an alias.

Also even if we used fully qualified access, like Niall suggested 
(#org.package.class.Constants.CONSTANT#), that would be problematic because the 
reference is relative to the parameterClass. The dot notation is used to lookup 
values in the parameterClass. So we would need to provide a notation for fully 
qualified class name. Personally, i dont think we should provide that support. 
It should be through aliases only and we should have a notation to express that 
our reference is an alias.

> 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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to