[jboss-user] [EJB 3.0] - Problem retrieving dates from database

chawax do-not-reply at jboss.com
Fri Nov 16 05:43:40 EST 2007


Hi,

I have a EJB3 entity with a java.util.Date attribute defined as following :

private java.util.Date dateDebut;
  | 
  | @javax.persistence.Column(name = "DATE_DEBUT", nullable = false, insertable = true, updatable = true)
  | @javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
  | public java.util.Date getDateDebut()
  | {
  |     return dateDebut;
  | }
  | 
  | public void setDateDebut(java.util.Date value)
  | {
  |     this.dateDebut = value;
  | }

But when I run SQL queries, the dateDebut attribute contains java.sql.Date data instead of java.util.Date ! So then I encounter problems when formatting this date ... What should I do so that SQL dates are converted to java.util.Date in my EJB3 entities ?

Thanks in advance,

P.S. : I run on JBoss 4.2.0.GA with MySQL database (same problem with HSQLDB anyway).

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

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



More information about the jboss-user mailing list