one parameter 2 times?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

one parameter 2 times?

nino martinez wael
Hi should'nt this work:

@Select("Select floatColumn from table where enddatetime > #{from} and enddatetime > #{from} ")
public float selectTotalServiceLevelData(Date from);

I mean using the parameter 2 times?

regards Nino
Reply | Threaded
Open this post in threaded view
|

Re: one parameter 2 times?

Larry Meadors
Yes - add an @Param annotation to the method parameter and it will.

On Tue, Oct 19, 2010 at 6:53 AM, nino martinez wael
<[hidden email]> wrote:
> Hi should'nt this work:
> @Select("Select floatColumn from table where enddatetime > #{from} and
> enddatetime > #{from} ")
> public float selectTotalServiceLevelData(Date from);
> I mean using the parameter 2 times?
> regards Nino
Reply | Threaded
Open this post in threaded view
|

Re: one parameter 2 times?

Guy Rouillier
In reply to this post by nino martinez wael
On 10/19/2010 8:53 AM, nino martinez wael wrote:
> Hi should'nt this work:
>
> @Select("Select floatColumn from table where enddatetime > #{from} and
> enddatetime > #{from} ")
> public float selectTotalServiceLevelData(Date from);
>
> I mean using the parameter 2 times?

Yes.

--
Guy Rouillier
Reply | Threaded
Open this post in threaded view
|

Re: one parameter 2 times?

nino martinez wael
Hmm ok, I've now put in the params as proposed, and I get a different error.

I've tested the query and it works from SQL squirrel. 

I guess the question are that how do I map between the SQL fragment : TO_DATE(\"#{from}\", \"%Y-%m-%d %H:%M\") and @Param("from") Date from. Should I somehow also specify a date format, or should I change it to a string instead? What is best practice?

-Nino


2010/10/20 Guy Rouillier <[hidden email]>
On 10/19/2010 8:53 AM, nino martinez wael wrote:
Hi should'nt this work:

@Select("Select floatColumn from table where enddatetime > #{from} and
enddatetime > #{from} ")
public float selectTotalServiceLevelData(Date from);

I mean using the parameter 2 times?

Yes.

--
Guy Rouillier

Reply | Threaded
Open this post in threaded view
|

Re: one parameter 2 times?

nino martinez wael
Ok, I've now put in the params as proposed, and I get a different error .

I've tested the query and it works from SQL squirrel. 

I guess the question are that how do I map between the SQL fragment : TO_DATE(\"#{from}\", \"%Y-%m-%d %H:%M\") and @Param("from") Date from. Should I somehow also specify a date format, or should I change it to a string instead? What is best practice?

-Nino

2010/10/20 nino martinez wael <[hidden email]>
Hmm ok, I've now put in the params as proposed, and I get a different error.

I've tested the query and it works from SQL squirrel. 

I guess the question are that how do I map between the SQL fragment : TO_DATE(\"#{from}\", \"%Y-%m-%d %H:%M\") and @Param("from") Date from. Should I somehow also specify a date format, or should I change it to a string instead? What is best practice?

-Nino


2010/10/20 Guy Rouillier <[hidden email]>

On 10/19/2010 8:53 AM, nino martinez wael wrote:
Hi should'nt this work:

@Select("Select floatColumn from table where enddatetime > #{from} and
enddatetime > #{from} ")
public float selectTotalServiceLevelData(Date from);

I mean using the parameter 2 times?

Yes.

--
Guy Rouillier


Reply | Threaded
Open this post in threaded view
|

Re: one parameter 2 times?

Larry Meadors
A different error? :/

Throw us a bone here.

Larry


On Wed, Oct 20, 2010 at 2:24 AM, nino martinez wael
<[hidden email]> wrote:

> Ok, I've now put in the params as proposed, and I get a different error .
> I've tested the query and it works from SQL squirrel.
> I guess the question are that how do I map between the SQL fragment
> : TO_DATE(\"#{from}\", \"%Y-%m-%d %H:%M\") and @Param("from") Date from.
> Should I somehow also specify a date format, or should I change it to a
> string instead? What is best practice?
> -Nino
> 2010/10/20 nino martinez wael <[hidden email]>
>>
>> Hmm ok, I've now put in the params as proposed, and I get a different
>> error.
>> I've tested the query and it works from SQL squirrel.
>> I guess the question are that how do I map between the SQL fragment
>> : TO_DATE(\"#{from}\", \"%Y-%m-%d %H:%M\") and @Param("from") Date from.
>> Should I somehow also specify a date format, or should I change it to a
>> string instead? What is best practice?
>> -Nino
>>
>> 2010/10/20 Guy Rouillier <[hidden email]>
>>>
>>> On 10/19/2010 8:53 AM, nino martinez wael wrote:
>>>>
>>>> Hi should'nt this work:
>>>>
>>>> @Select("Select floatColumn from table where enddatetime > #{from} and
>>>> enddatetime > #{from} ")
>>>> public float selectTotalServiceLevelData(Date from);
>>>>
>>>> I mean using the parameter 2 times?
>>>
>>> Yes.
>>>
>>> --
>>> Guy Rouillier
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: one parameter 2 times?

nino martinez wael
yeah I get sql syntax error :(  probably because the Date is'nt formatted correctly..

2010/10/20 Larry Meadors <[hidden email]>
A different error? :/

Throw us a bone here.

Larry


On Wed, Oct 20, 2010 at 2:24 AM, nino martinez wael
<[hidden email]> wrote:
> Ok, I've now put in the params as proposed, and I get a different error .
> I've tested the query and it works from SQL squirrel.
> I guess the question are that how do I map between the SQL fragment
> : TO_DATE(\"#{from}\", \"%Y-%m-%d %H:%M\") and @Param("from") Date from.
> Should I somehow also specify a date format, or should I change it to a
> string instead? What is best practice?
> -Nino
> 2010/10/20 nino martinez wael <[hidden email]>
>>
>> Hmm ok, I've now put in the params as proposed, and I get a different
>> error.
>> I've tested the query and it works from SQL squirrel.
>> I guess the question are that how do I map between the SQL fragment
>> : TO_DATE(\"#{from}\", \"%Y-%m-%d %H:%M\") and @Param("from") Date from.
>> Should I somehow also specify a date format, or should I change it to a
>> string instead? What is best practice?
>> -Nino
>>
>> 2010/10/20 Guy Rouillier <[hidden email]>
>>>
>>> On 10/19/2010 8:53 AM, nino martinez wael wrote:
>>>>
>>>> Hi should'nt this work:
>>>>
>>>> @Select("Select floatColumn from table where enddatetime > #{from} and
>>>> enddatetime > #{from} ")
>>>> public float selectTotalServiceLevelData(Date from);
>>>>
>>>> I mean using the parameter 2 times?
>>>
>>> Yes.
>>>
>>> --
>>> Guy Rouillier
>>
>
>