[jboss-user] [EJB 3.0] - TimeStamp problem

rkiran81 do-not-reply at jboss.com
Mon May 19 03:14:50 EDT 2008


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151659#4151659

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151659



More information about the jboss-user mailing list