openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ram <ram_ku...@yahoo.co.in>
Subject persisting object of perticular date format
Date Wed, 02 Feb 2011 20:37:14 GMT
I have a date in string format 
    
 format yyyy-MM-dd'T'HH:mm:ss.
   e.g.2010-12-25T12:00:00

I created entity from the tables . Here is my employee entity.

Class Emp{
  String id,
  java.sql.date joinDate
}

 As i see to_date() is not applicable in JPA,  How can i persist the joined date in the same
format 2010-12-25T12:00:00 into the database by using jpa. 

How can i specify this format yyyy-MM-dd'T'HH:mm:ss.

   Later on i want to search the emp who has joined in the format (yyyy-mm-dd) 2010-12-25,
so that i can get all the values from the database
2010-12-25T12:00:00
2010-12-25T11:00:00
2010-12-25T10:05:00

@NamedQuery(name="getEmployeeByDate",query="select p from Emp p where p.joinDate =? ")



Thanks,
Ram



Mime
View raw message