I want to retrieve all records with shelfId=1 and between two dates. I wrote a query like this in my webservice Its not working. can anyone please correct this one.
@NamedQuery(name = "BinEnvironment.BinEnvironmentByStartDateEndDate", query = "SELECT b FROM BinEnvironment b where shelfId ='?1' and dateTime between '1?' and '?2'")
Reply as soon as possible
Regards
Hema
There is a problem with your parameter declaration: you are trying to use the same param for shelfId
and dateTime
.
The declaration of parameters for the between
case shoudl probably be between '?2' and '?3
.
Please note the correct syntax (use ?1
instead of 1?
):
Input parameters are designated by the question mark (?) prefix followed by an integer. For example: ?1.