Hi Mick,

> JBoss is what I use. Sorry.

Sorry? Why? :)

> How would I then add a second parameter in the SQL I added here? I just have
> only used single values thusfar.
For example...

// In the Bean definition

 * @ejb:finder
 *    signature="java.util.Collection findSomethingByDate(java.util.Date
relativeDate,java.lang.String aCode)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(r)
 *           FROM TSomething s
 *           WHERE s.smtCode=?2
 *           AND s.smtDate > ?1
 *           "

// In a session bean
Collection somethingies =
          somethingHome.findSomethingByDate(aCalendar.getTime(), someCode);

As simple as that. If you need to go up to the millisecond, you might want to
use java.sql.Date instead of java.util.Date.

I hope it helps,
D.

> 
> 
> ---
> Thanks
> Mick Knutson
> 
> The world is a playground...Play Hard, Play Smart.
> Visit  http://www.YourSoS.com to learn how our "Personal Emergency Alert &
> Contact System" can help you Play Smart.
> 
> 
> +00 1 (877) SoS-9119
> +00 1 (708) 570-2772 Fax
> ---
> 
> ----- Original Message ----- 
> From: "Daniel Lopez" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, October 04, 2003 5:51 AM
> Subject: Re: [Xdoclet-user] after Today in the where clause?
> 
> 
> Hi,
> As Konstantin says, unless you want to get into container dependent issues,
> you
> could specify a date as a parameter in your finder and then pass a Date,
> with
> the current date, when calling it. It's not as simple as writing a simple
> SQL
> sentence, but it works and it is DB and container portable. We also use it
> because when you need to do some date arithmetic (p.e. whateverDate is 3
> months
> older than today) it is easier and more portable to do it in Java before
> calling
> the finder. Besides, many containers don't allow date operations inside the
> EJBQL, as it is out of the spec.
> My 2ec,
> D.
> 
> > --- Mick Knutson <[EMAIL PROTECTED]> wrote:
> > > I have a query that I want to restrict the
> > > Alert.startDate >= Today.
> > > How can I do that with this query:
> > >
> > >  * @ejb.finder   signature="java.util.Collection
> > > findAllByUserId(
> > > java.lang.Long pUserId )"
> > >  *               query="SELECT OBJECT(c) FROM Alert
> > > AS c WHERE c.userId =
> > > ?1"
> > >
> >
> > Not exactly xdoclet question.... It really depensd on
> > what app server you are using. And if EJBQL exposes
> > today to you... Or maybe you
> > shall pass "today" value to the finder....
> > And to watch whether to use java.util.Date or
> > java,sql.Date...
> >
> > regards,
> >
> > =====
> > ----[ Konstantin Pribluda ( ko5tik ) ]----------------
> > Zu Verst�rkung meines Teams suche ich ab Sofort einen
> > Softwareentwickler[In] f�r die Festanstellung.
> > Arbeitsort: Mainz
> > Skills:  Programieren, Kentnisse in OpenSource-Bereich
> > ----[ http://www.pribluda.de ]------------------------
> >
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Shopping - with improved product search
> > http://shopping.yahoo.com
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > xdoclet-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> 
> --
> This message was sent using Sake Mail, a web-based email tool from
> Endymion Corporation.  http://www.endymion.com/products/sake
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user

--
This message was sent using Sake Mail, a web-based email tool from
Endymion Corporation.  http://www.endymion.com/products/sake
JBoss is what I use. Sorry.

How would I then add a second parameter in the SQL I added here? I just have
only used single values thusfar.


---
Thanks
Mick Knutson

The world is a playground...Play Hard, Play Smart.
Visit  http://www.YourSoS.com to learn how our "Personal Emergency Alert &
Contact System" can help you Play Smart.


+00 1 (877) SoS-9119
+00 1 (708) 570-2772 Fax
---

----- Original Message ----- 
From: "Daniel Lopez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 04, 2003 5:51 AM
Subject: Re: [Xdoclet-user] after Today in the where clause?


Hi,
As Konstantin says, unless you want to get into container dependent issues,
you
could specify a date as a parameter in your finder and then pass a Date,
with
the current date, when calling it. It's not as simple as writing a simple
SQL
sentence, but it works and it is DB and container portable. We also use it
because when you need to do some date arithmetic (p.e. whateverDate is 3
months
older than today) it is easier and more portable to do it in Java before
calling
the finder. Besides, many containers don't allow date operations inside the
EJBQL, as it is out of the spec.
My 2ec,
D.

> --- Mick Knutson <[EMAIL PROTECTED]> wrote:
> > I have a query that I want to restrict the
> > Alert.startDate >= Today.
> > How can I do that with this query:
> >
> >  * @ejb.finder   signature="java.util.Collection
> > findAllByUserId(
> > java.lang.Long pUserId )"
> >  *               query="SELECT OBJECT(c) FROM Alert
> > AS c WHERE c.userId =
> > ?1"
> >
>
> Not exactly xdoclet question.... It really depensd on
> what app server you are using. And if EJBQL exposes
> today to you... Or maybe you
> shall pass "today" value to the finder....
> And to watch whether to use java.util.Date or
> java,sql.Date...
>
> regards,
>
> =====
> ----[ Konstantin Pribluda ( ko5tik ) ]----------------
> Zu Verst�rkung meines Teams suche ich ab Sofort einen
> Softwareentwickler[In] f�r die Festanstellung.
> Arbeitsort: Mainz
> Skills:  Programieren, Kentnisse in OpenSource-Bereich
> ----[ http://www.pribluda.de ]------------------------
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user

--
This message was sent using Sake Mail, a web-based email tool from
Endymion Corporation.  http://www.endymion.com/products/sake


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to