geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Voutat" <olivier.vou...@gmail.com>
Subject Re: FindByPrimaryKey
Date Thu, 06 Apr 2006 22:05:39 GMT
Since I was using common beans to save the data, to send to my Session Bean
that uses my Entity Bean for registring the information I did as simple as
that in the common bean:

Timestamp startDate;

public void setStartDate(String date) {
            this.startDate = Timestamp.valueOf(date);
}

public Timestamp getStartDate() {
            return this.startDate;
}

and change the type of my Entity beans methods for date set and get of
course. Works perfectly. Thanks again people.

Best Regards,
Olivier Voutat

On 4/6/06, David Carew <dccarew@gmail.com> wrote:
>
> The java.sql.Timestamp class has a static method  called valueOf to
> convert Strings in the format yyyy-mm-dd hh:mm:ss.fffffffff  (where
> ffffffffff represents nanoseconds) to a java.sql.Timestamp instance.  As
> pointed out previously, this is easier than writing your own converter.  See
> Javadocs for java.sql.Timestamp for more info.
>
> In your  Entity Bean class you would declare the field like the following:
>
>
> public abstract java.sql.Timestamp getstartDate();
>
> public abstract void setStartDate(java.sql.Timestamp newStartDate);
>
> And then you can use Timestamp.valueOf(String yourStartDateAsString) to
> convert as appropriate.
>
>
>
>
>


--
Olivier Jeanpierre Voutat
Rua Praia de Muriú, 9188
Cep 59092-390 / Natal - RN
Tel: (84) 3219-0427 Cel: (84) 9977-3917

Mime
View raw message