0 Replies Latest reply on May 19, 2008 3:14 AM by rkiran81

    TimeStamp problem

    rkiran81

      Hi All,

      My development environment is jboss-4.0.3SP1 server and used jboss-EJB-3.0_RC6-PFD to setup my jboss for ejb3.
      MSSQL Server 2005.

      I have table with 2 columns PROFILE_ID (bigint) and MON_START(datetime).

      The bean for this is.
      @Entity
      @Table(name="LK_PROFILE_ACCESSTIMES")
      public class AccessTimesProfileBean implements Serializable
      {
      static final long serialVersionUID = -8477912839066947004L;
      private long id;
      private Timestamp mondayStart = null;

      @Id
      @Column(name="PROFILE_ID")
      public long getId()
      {
      return id;
      }

      public void setId(long id)
      {
      this.id = id;
      }

      @Column(name="MON_START")
      public Timestamp getMondayStart()
      {
      return mondayStart;
      }

      public void setMondayStart(Timestamp mondayStart)
      {
      this.mondayStart = mondayStart;
      }
      }

      The bean is called from a servlet.
      I Create a calendar object in servlet like this (but hour and minute comes from client side which is a string converted to int. here i have just hardcoded and here i am concerned with only hour and minute.)
      Calendar start = new GregorianCalendar(1970,Calendar.JANUARY,1,22,58)
      and call the sessionbean passing this calendar to persist.


      Now i set the timestamp to entitybean and persist it.
      accessTimesProfileBean.setMondayStart(new Timestamp(start .getTimeInMillis()));

      when retrieving i get the timestamp, create a new calendar object out of it and send it back to servlet.

      if i print the hour of day and minute in sessionbean it prints correct values but after the call is transfered from sessionbean to servlet and now if i try to print like calendarObject.get(Calendar.HOUR_OF_DAY);
      calendarObject= monEnd.get(Calendar.MINUTE);
      nothing is getting printed.

      when i printed the calendarObject i found sun/util/calendar/BaseCalendar is comming null.
      i
      Can anybody please look into this and suggest.