hongluu / krank

Automatically exported from code.google.com/p/krank
0 stars 0 forks source link

patch to add first and max results, and named parameters for queries #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, using annotations, I've been able to extend the excellent work you all
have done with this nascent project.

I've attached a patch allowing someone to annotate a named query, first
with @AnnotatedNamedQuery ( to notify the finder that we'll be using named
queries with named parameters ) 

Each parameter can then have @NamedParameter, @FirstResult, or @MaxResults.

FirstResult and MaxResult are expected to be integers, and NamedParameter
has a single value() that takes the name of the parameter.

so an example would be :

@AnnotatedNamedQuery  List<Employee> findEmployeesInVacationPeriod(
@NamedParameter('startDate') Date startDate, @NamedParameter('endDate')
Date endDate, @FirstResults first, @MaxResults max ) ;

The error checking is still pretty nominal ( and I'm not the best at
annotations/generics ), but hopefully you or others will find this useful.

Original issue reported on code.google.com by aadi.des...@gmail.com on 15 May 2007 at 10:57

GoogleCodeExporter commented 8 years ago
sorry, patch added

Original comment by aadi.des...@gmail.com on 15 May 2007 at 10:58

Attachments:

GoogleCodeExporter commented 8 years ago
This is cool and I will take a look. Thanks!

Original comment by RichardH...@gmail.com on 6 Jun 2007 at 9:16

GoogleCodeExporter commented 8 years ago
I took a look. Very nice.

Original comment by RichardH...@gmail.com on 6 Sep 2007 at 3:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I really like this feature. Is there any chance for this to be added?
Now, I use my own branch of Crank with this patch added. :)

Original comment by peter.we...@gmail.com on 26 Jan 2009 at 7:01