You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Josh Joy <jo...@gmail.com> on 2009/09/20 07:47:47 UTC
Configuration by Convention - query by example and method naming
convention
Hi,
I see on the ibatis 3.0 whiteboard, there are several proposed
examples of conventions, such as the following
"If we want parameters for a "query by example", we can support
something like this:
List<Employee> findEmployeesLike(Employee employee);
Assuming only lastName is set, all other reference types are null, and
primitives are set to some invalid number like -1...we can generate
something like:
SELECT id, firstName, lastName FROM Employee WHERE lastName = 'Begin'
Or a better convention by naming could be:
List<Employee> findEmployeeByLastNameAndFirstName (String last, String first);
This will yeild:
SELECT id, firstName, lastName FROM Employee WHERE lastName = 'Begin'
AND firstName = 'Clinton'"
Is query by example and method naming conventions supported? I looked
through the user guide for 3.0 and was unable to find any references
to the above... I think it would making coding easier if the above was
supported...
Thanks,
Josh
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: Configuration by Convention - query by example and method naming
convention
Posted by Clinton Begin <cl...@gmail.com>.
No, the convention stuff was dropped for now (or perhaps, not yet
implemented).
Clinton
On Sat, Sep 19, 2009 at 11:47 PM, Josh Joy <jo...@gmail.com> wrote:
> Hi,
>
> I see on the ibatis 3.0 whiteboard, there are several proposed
> examples of conventions, such as the following
>
> "If we want parameters for a "query by example", we can support
> something like this:
>
> List<Employee> findEmployeesLike(Employee employee);
>
> Assuming only lastName is set, all other reference types are null, and
> primitives are set to some invalid number like -1...we can generate
> something like:
>
> SELECT id, firstName, lastName FROM Employee WHERE lastName = 'Begin'
>
> Or a better convention by naming could be:
>
> List<Employee> findEmployeeByLastNameAndFirstName (String last, String
> first);
>
> This will yeild:
>
> SELECT id, firstName, lastName FROM Employee WHERE lastName = 'Begin'
> AND firstName = 'Clinton'"
>
>
> Is query by example and method naming conventions supported? I looked
> through the user guide for 3.0 and was unable to find any references
> to the above... I think it would making coding easier if the above was
> supported...
>
> Thanks,
> Josh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>