Thanks Clinton
I am still missing one piece i.e. how to invoke this mapper. Do I use
SqlMapClient? An example code will be great.
Thanks a lot!
Clinton Begin wrote:
>
> @SelectProvider should be applied to your Mapper interface. For example:
>
> public interface MyMapper {
> @Select("SELECT * FROM users")
> User selectUsers();
> }
>
> The SelectProvider equivalent of this would be:
>
>
> public interface MyMapper {
>
> @SelectProvider(type=com.me.SomeHelperClass,method="getSelectAllUsersSQL")
>
> User selectUsers();
> }
>
> public clas SomeHelperClass {
> public String getSelectAllUsersSQL() {
> return "SELECT * FROM users";
> }
> }
>
> Cheers,
> Clinton
>
>
>
> On Wed, Jan 13, 2010 at 11:37 AM, kruba02 <[email protected]> wrote:
>
>>
>> Hi,
>>
>> I am trying to execute a dynamic/custom query using iBATIS (using
>> #SelectProvider) and am facing a couple of issues.
>>
>> 1. I have something like @SelectProvider(method = "selectTest", type =
>> "com.a.b.DynamicSQL") where method is the method-name and type is the
>> name
>> of the class. I get an error here. Both the class and method exist.
>> selectTest looks like following. Any idea how I can remove the error?
>>
>> public String selectTest(){
>> BEGIN();
>> SELECT("*");
>> FROM("test");
>> return SQL();
>> }
>>
>> 2. The documentation says that @SelectProvider is a method annotation. If
>> I
>> annotate a method say Foo() using the above @SelectProvider, what should
>> the
>> method itself have?
>>
>> 3. Lastly, how do I invoke this select query?
>>
>> Your help is much appreciated. Sorry, I am just getting started with
>> iBATIS.
>> Also, are there any other ways to execute queries which are constructed
>> on
>> the fly?
>>
>> Thanks in advance for your help.
>> KA
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-use-%40SelectProvider-tp27148804p27148804.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/How-to-use-%40SelectProvider-tp27148804p27152145.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]