3 Replies Latest reply on Sep 13, 2007 1:07 PM by Casey Boyd

    Seam Pros - Need your opinion...Date vs Long

    Casey Boyd Novice

      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