org.perfectjpattern.jee.api.integration.dao
Annotation Type QueryParameters
@Retention(value=RUNTIME)
public @interface QueryParameters
Defines the order and correspondence between interface method arguments and
named query parameters. Named query parameters when retrieved they don't have
a predictable order, besides compiled byte code loses the argument names
thus without this annotation there would be no predictable way to map the
finder method arguments to the query parameters.
For example a named query defined like:
<query name="Customer.findByNumberOfOrdersBetween">
<![CDATA[SELECT c1
FROM Customer c1
WHERE c1.id IN
(SELECT c2.id
FROM Customer c2 inner join c2.orders o
WHERE o.date BETWEEN :Begin AND :End
GROUP BY c2.id
HAVING Count(*) >= :Minimum
)
]]>
Would correspond to an interface method definition with
the QueryParameters
in the following way:
public interface ICustomerDao
extends IGenericDao<Long, Customer>
{
@QueryParameters(names = { "Begin", "End", "Minimum" })
public List<Customer>
findByNumberOfOrdersBetween(Date aBegin, Date anEnd, long aMinimum);
}
- Version:
- $Revision: 1.0 $Date: Feb 12, 2009 11:08:00 PM $
- Author:
- Giovanni Azua
-
-
names
public abstract String[] names
Copyright © 2007-2009. All Rights Reserved.