[jboss-user] [JBoss Seam] - Seam Pros - Need your opinion...Date vs Long

indyJones do-not-reply at jboss.com
Thu Sep 13 11:48:00 EDT 2007


I have a POJO that needs to store date information.

But, I don't want to store the Java type "Date" in my database, I prefer to store my date in the database as Java type "Long".

This is all fine and good, but when i display this POJO, i dont want the Long number displayed for my date, I want a readable date format...

Right now, I have 2 properties on my POJO...


  | 
  | 	public Long getDate() { return date; }
  | 	public void setDate(Long date) { this.date = date; }
  | 
  | 	public Date getDateDisplay() { return datedisply; }
  | 	public void setDateDisplay(Date datedisplay) { this.datedisplay = datedisplay; }
  | 
  | 

I use one method to save to the database and the other in my JSF EL calls to display on a page.

Is there a better way of doing this?

Is there a JSF tag to convert a Long into a Date?

Is there a way to have a property on my POJO without saving it to the database? (Right now i have 2 columns with the same data)

Or, am I just doing this wrong?

Thanks

Indy


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

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



More information about the jboss-user mailing list