[
https://issues.apache.org/jira/browse/IBATIS-414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501694
]
Jeff Butler commented on IBATIS-414:
------------------------------------
The more I think about it, the more I dislike the configuration option. How
about if I just make the relevent methods and fields protected instead of
private? You'll have to write a class like this:
ExtendedExample extends SomeTableExample {
public ExtendedCriteria createExtendedCriteria() {
ExtendedCriteria criteria = new ExtendedCriteria();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
public static class ExtendedCriteria extends SomeTableExample.Criteria {
public ExtendedCriteria andCodeLikeCaseInsensitive(String value) {
addCriterion("upper(code) like", value.toUpperCase(), "code");
return this;
}
}
}
This will be a quick change for me and will also make it possible to extend
these classes.
> Allow extending the Example classes or allow hand written criteria
> ------------------------------------------------------------------
>
> Key: IBATIS-414
> URL: https://issues.apache.org/jira/browse/IBATIS-414
> Project: iBatis for Java
> Issue Type: Improvement
> Components: Tools
> Affects Versions: 2.3.0
> Environment: Java 1.5, Maven 2, ANT 1.6.5, Ibatis 2.3.0, abator 1.0.0
> Reporter: James Burton
>
> I currently have database searches implemented very nicely with abator
> generated code. I use the Example classes with the 'and..Like' criteria to do
> this. It works great.
> However, I now have a requirement to make these searches case-insensitive.
> After a bit of thinking I decided to try and extend the generated Example
> classes and override the 'and..Like' methods to add in the required upper()
> functions that Sybase requires to get true case insensitivity. I need to get
> a criteria added something like this...
> addCriterion("upper(code) like", value, "upper(code)");
> The problem is, I cannot extend the Example classes because there is no
> public constructor on the 'Criteria' inner class. Nor does the Example class
> allow a 'hand written' criteria to be added. This too, would be very useful.
> Do you think you could add a public constructor or make the existing one
> public? Either that or add methods to allow adding a hand-written criteria?
> ..or is there a better way to do this that I have completely missed?
> If not,
> Thanks,
> James
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.